Greetings, im new to this site and still new to coding. Im having trouble with this project.
b. A loop should be used to iterate once for each ticket. In each iteration, the loop should ask the user:
the desired location in the concert location for a ticket; a letter (either section F (for floor), A, B, C, or L (for lawn). Note accept both upper and lowercase letters - If an incorrect location is entered keep asking for the user to re-enter till a correct letter is entered.
then ask the user the row location; each section has rows 1 - 50 (except for the lawn - which is standing room only and no assigned seating); use the chart below to assign a price to a ticket
if they are a member of the artist's fan club discount the ticket by 10%
Display the number of tickets in each section, the subtotal for the tickets in each section, and the grand total for all tickets purchased by the user (you do not need an array - as we have not covered them yet - just use variables)..
I think i got a good part of it down, however i need help with assigning the correct value to the tickets, and coming up with the total value/displaying the values. I honestly just dont understand how to go about doing it, i know a count variable is involved i just cant wrap my head around exactly how to do that. I hope you guys can help out a bit, and i really do appreciate you guys taking time out of your lives to help people. When im actually good at coding ill try my best to help others too.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include <iostream>
using namespace std;
int main()
{
int tickets = 0;
int numOfTickets = 0;
int row = 0;
char letters;
bool choice;
bool choice2;
int club = 0;
int i = 0;
cout << "How many tickets do you need?" << endl;
cin >> tickets;
if (tickets < 1 || tickets > 25)
{
cout << "You have entered an invalid ammount of tikets! Pleas enter an amount within the range of 1-25." << endl;
cin >> tickets;
}
for (int i = 0; i < tickets; i++)
{
do
{
cout << "What is your desired location for each ticket? A,a B,b C,c L,l(lawn) F,f(floor) " << endl;
cin >> letters;
if (letters == 'A' || 'a' || 'B' || 'b' || 'C' || 'c' || 'L' || 'l' || 'F' || 'f')
{
cout << "Please enter which row you would like to be in" << endl;
cin >> row;
while (row < 1 || row >50);
{
cout << "Error please enter a number between 1 and 50";
}
choice = false;
}
else
{
cout << "Sorry you have entered an incorrect location, please enter a valid location" << endl;
choice = true;
}
} while (choice == true);
}
do
{
cout << "Are you a member of the artist's fan club? Enter 1 for yes, and 0 for no." << endl;
cin >> club;
if (club == 1 || 2)
{
choice2 = false;
}
else
{
cout << "you have entered and invalid response!" << endl;
choice2 = true;
}
} while (choice2 == true);
return 0;
}
|