1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kirill [66]
3 years ago
7

Write a program in C++ that can be used by a small theater to sell tickets for performances.The theater’s auditorium has 15 rows

of seats with 20 seats in each row.Step 1 The program should have a FUNCTION that displays a screen that shows which seats are available and which are taken. Seats that are taken should be represented by a # symbol and seats that are available should be represented by a * symbol. The first thing your program should do is initialize all of the seats to available (*) and display the seating chart. (HINT: The seating chart should be a two dimensional array.) Here is an example of the seating chart with all seats initialized to availablei causersAdministrator documents\visual studio 201 bug Sample.exe * Seats available # Re served Seats eats: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Row 3 Row 5 nu: 1 Buy ticket Total sel1 and exit Enter your choice 1 Enter row:3 Enter seat 0Step 2 Each row in the auditorium has a different ticket price. So tickets in row 0 may be 5.00 each and tickets in row 1 may be 10.00 each. Your program should have a FUNCTION that reads the ticket price of each row from an input file called prices.txt. The ticket price for each row should be stored in a one dimensional array.The prices txt file contains: you must use the prices.txt file. Use the fstream header.101010888666444222Step 3 Your program should have variables tracking the total number of tickets sold and the total revenue for all tickets sold.Step 4 Your program should allow the user to sell tickets one at a time. The user should be able to sell as many tickets as they would like (you need a loop for this). Do this with some sort of prompt or menu asking the user if they would like to sell another ticket. Don’t forget to validate input data if you need to. To allow the user to sell a ticket your program should have the user enter a row number and a seat number for the ticket they would like to sell. The program should do four things with this information: 1. It should check to see if the seat is available. If the seat is taken the program should not allow the user to sell the ticket. If this happens, print a message to the user saying the ticket is not available and prompt the user to see if they would like to sell another ticket. 2. If the seat is available the program should update the seating chart by putting a taken symbol (#) in that seat’s position in the chart. 3. The program should then look up the row price for the seat sold. Your program should have a variable tracking the total revenue, the price of the seat sold should be added to this total after each sale. 4. Your program should have a variable tracking the total tickets sold. The next thing your program should do when selling a ticket is update the total tickets sold.Step 5 Once the user is finished selling tickets print out an updated seating chart followed by the total tickets sold and the total revenue generate from those tickets. NOTE: You are required to use two arrays in this program, one for the seating chart and one to store the prices for each row. You are also required to use two functions: one to display the seating chart and one to read in the price per row data and store it in the array with the prices for each row in it. You may use other functions if you want to but they are not required.
Engineering
1 answer:
Natalka [10]3 years ago
7 0

Answer:

See explaination

Explanation:

#include<iostream>

using namespace std;

char seating[15][20];

float row_price[15];

//This function will display the seating chart

void display()

{

cout<<"-------------------------- Seating Chart----------------------------\n";

cout<<"Seats: ";

for(int i=0;i<20;i++)

cout<<i<<" ";

cout<<"\n";

for(int i=0;i<15;i++)

{

if(i<10)

cout<<"Row "<<i<<" ";

else

cout<<"Row "<<i<<" ";

for(int j=0;j<20;j++)

{

if(j<10)

cout<<seating[i][j]<<" ";

else

cout<<seating[i][j]<<" ";

}

cout<<"\n";

}

}

//This function will prompt to the user to enter row fares

void row_price_details()

{

cout<<"Enter row wise fares:\n";

for(int i=0;i<15;i++)

cin>>row_price[i];

}

//Main function

int main()

{

char choice;

int i,j,row,seat;

float revenue=0;

//step-1 initializing seating chart with * (available)

for(i=0;i<15;i++)

{

for(j=0;j<20;j++)

{

seating[i][j]='*';

}

}

//displaying seating chart by calling display() function

display();

//prompt the user to enter row fares by calling row_price_details() function

row_price_details();

//Booking seats until user say n or N

do{

cout<<"Enter Row number and Seat number:\n";

cin>>row>>seat;//getting seat and row numbers

//validating enter seat number or row number or with in boundry or not

//if not displays Error message

if(row<15||seat<<20)

{

//checking entered position is available or not

//if not displays sorry message

if(seating[row][seat]=='*')

{

revenue=revenue+row_price[row];//calculating revenue

seating[row][seat]='#';//making seat unavailable

cout<<"Thankyou for Booking\n";

}

//sorry message

else

{

cout<<"The position yor entered is not available\n See seating chart to know available seats\n";

display();

}

}

//Error message

else

{

cout<<"Invalid seat number or row number....\n";

}

cout<<"Do you want to buy another ticket?\nif yes enter Y or y else N or n\n";

cin>>choice;

}while(choice=='Y'||choice=='y');

//displaying summery of the booking

//seating chart and revenue

cout<<"After booking the seating chart:\n";

display();

cout<<"Total Revenue:\n"<<revenue;

}

You might be interested in
Its been days wsgggggg
Nataly [62]

Answer: ok

Explanation:

4 0
2 years ago
Read 2 more answers
A cylindrical drill with radius 4 is used to bore a hole through the center of a sphere of radius 5. Find the volume of the ring
ANTONII [103]

Answer:

The volume of the ring shaped solid that remains is 21 unit^3.

Explanation:

The total volume of the sphere is given as:

Volume of Sphere = (4/3)πr^3

where, r = radius of sphere

Volume of Sphere = (4/3)(π)(5)^3

Volume of Sphere = 523.6 unit^3

Now, we find the volume of sphere removed by the drill:

Volume removed = (Cross-sectional Area of drill)(Diameter of Sphere)

Volume removed = (πr²)(D)

where, r = radius of drill = 4

D = diameter of sphere = 2*5 = 10

Therefore,

Volume removed = (π)(4)²(10)

Volume removed = 502.6 unit^3

Therefore, the volume of ring shaped solid that remains will be the difference between the total volume of sphere, and the volume removed.

Volume of Ring = Volume of Sphere - Volume removed

Volume of Ring = 523.6 - 502.6

<u>Volume of Ring = 21 unit^3</u>

5 0
3 years ago
Consider a simply supported rectangular beam with a span length of 10 ft, a width of 8 in, and an effective depth of 20 in. Norm
yulyashka [42]

Answer:

beam with a span length of 10 ft, a width of 8 in, and an effective depth of 20 in. Normal weight concrete is used for the beam. This beam carries a total factored load of 9.4 kips. The beam is reinforced with tensile steel, which continues uninterrupted into the support. The concrete has a strength of 4000 psi, and the yield strength of the steel is 60,000 psi. Using No. 3 bars and 60,000 psi steel for stirrups, do the followings:

8 0
2 years ago
A standard penetration test has been conducted on a coarse sand at a depth of 16 ft below the ground surface. The blow counts ob
scoray [572]

Solution :

Given :

The number of blows is given as :

0 - 6 inch = 4 blows

6 - 12 inch = 6 blows

12 - 18 inch = 6 blows

The vertical effective stress $=1500 \ lb/ft^2$

                                              $= 71.82 \ kN/m^2$

                                             $ \sim 72 \ kN/m^2 $

Now,

$N_1=N_0 \left(\frac{350}{\bar{\sigma}+70} \right)$

$N_1 = $ corrected N - value of overburden

$\bar{\sigma}=$ effective stress at level of test

0 - 6 inch, $N_1=4 \left(\frac{350}{72+70} \right)$

                      = 9.86

6 - 12 inch, $N_1=6 \left(\frac{350}{72+70} \right) $

                        = 14.8

12 - 18 inch, $N_1=6 \left(\frac{350}{72+70} \right) $

                         = 14.8

$N_{avg}=\frac{9.86+14.8+14.8}{3}$

       = 13.14

       = 13

8 0
2 years ago
Fast plz-The mirror check may involve ______________.
barxatty [35]

Answer:

Realigning the mirror

Explanation:

mirrors should be aligned to minimize blind spots, not look at the tires.

6 0
2 years ago
Other questions:
  • An array of electronic chips is mounted within a sealedrectangular enclosure, and colling is implemented by attaching analuminum
    5·1 answer
  • A concrete mix design calls for 6.5 sacks of cement, a water/cement ratio of 0.45, and an air content of 2.5%. 1. Complete the m
    13·2 answers
  • How do batteries and other types of power sources make physical computing systems more mobile?
    15·2 answers
  • Intravenous infusions are usually driven by gravity by hanging the bottle at a sufficient height to counteract the blood pressur
    11·1 answer
  • Suppose a student rubs a Teflon rod with wool and then briefly touches it to an initially neutral aluminum rod suspended by insu
    6·1 answer
  • In the circuit given below, R1 = 17 kΩ, R2 = 74 kΩ, and R3 = 5 MΩ. Calculate the gain 1formula58.mml when the switch is in posit
    7·1 answer
  • A soil element is subjected to a minor principle stress of 50 kPa on a plane rotated 20 ° counterclockwise from vertical. If the
    10·1 answer
  • Any help is appreciated.
    7·1 answer
  • What additional information would make the following problem statement stronger? Select all that apply.
    8·1 answer
  • Since no one is perfect is that a sentence fragment
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!