Needs to be in basic pseudocode 3) The seating map for a particular performance
ID: 3869155 • Letter: N
Question
Needs to be in basic pseudocode
3) The seating map for a particular performance at a theater contains 70 rows of 100 seats each.
Assume that the following declarations have been made:
num desiredRowNumber
num desiredSeatNumber
num currentRow
num currentSeat
num rowSeatsReserved
num totalSeatsReserved
num seatsAvailable
a) Declare any other variables and constants needed and a 2-dimensional array to represent the seating map. This seating map applies only to this particular show. For other shows, the seating map may contain a different number of rows and seats per row, and the program must be capable of being modified for those by editing only two lines of code. Page 3 of 3
b) Allow a user to continuously enter a row number and seat number until they enter an appropriate sentinel value for the row number in order to stop entering input. Each time the user enters a valid row and seat number, the program determines if that seat is available, and if so, marks it as reserved with an “X” (available seats are not marked in any way). If the seat is not available, the program informs the user of this.
c) Once the user quits, the program outputs
i) each row number followed by the seat numbers in that row that have been reserved
ii) the total number of reserved seats
iii) the total number of available seats
example of what I'm looking for is;
start
Declarations
num itemPrice
num salespersonCommission
num customerDiscount
output “Welcome to the sales price calculator.”
output “This program will help you calculate the final”,
"price of a product adding in all factors.”
finalPrice= calculatePrice()
output “The total price after Commission, $” salespersonCommission, “and customer discount,”
“ customerDiscount “%, is”, finalPrice
stop
Explanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int Show_Menu ();
void Show_Chart ();
}
const char FULL = '*';
const char EMPTY = '#';
const int rows = 70;
const int columns = 100;
char map [rows][columns];
double price;
int main ()
{
const int Num_Rows = 70;
int price (Num_Rows);
cout << " *********************************************************" << endl;
cout << " * *" << endl;
cout << " * *" << endl;
cout << " *********************************************************" << endl;
cout << endl << endl;
for (int count = 0; count < rows; count++)
{
cout << "Please enter the price for row " << (count + 1) << ": ";
cin >> price [count];
count << endl;
}
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
map [i][j] = EMPTY;
}
int choice;
do
{
choice = Show_Menu();
switch (choice)
{
case 1:
cout << "Enter Ticket Prices ";
break;
case 2:
cout << "View Seat Prices ";
break;
case 3:
cout << "View Available Seats ";
Show_Chart ();
break;
case 4:
cout << "View Seat Sales ";
break;
case 5:
cout << "Purchase a Ticket ";
break;
case 6:
cout << "quit ";
break;
default : cout << "Error input ";
}
} while (choice != 6);
return 0;
}
int Show_Menu()
{
int MenuChoice;
cout << " MAIN MENU ";
cout << " 1. Enter Seat Prices. ";
cout << " 2. View Seat Prices. ";
cout << " 3. View Available Seats. ";
cout << " 4. View Ticket Sales. ";
cout << " 5. Purchase a Ticket. ";
cout << " 6. Quit the program. ";
cout << "_____________________ ";
cout << "Please enter your choice: ";
cin >> MenuChoice;
cout << endl << endl;
return MenuChoice;
}
void Show_Chart ()
{
cout << " Seats" << endl;
cout << " ";
for (int count = 0; count < 5; count++)
{
cout << "Row " << (count + 1);
for (int count2 = 0; count2 < 10; count2++)
{
cout << " " << map [count] [count2];
}
}
cout << endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.