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
Advantages of using metal
Contact [7]

Answer:

Metals have high melting points thus unlikely to degrade when temperatures increase, they can be fabricated and are cost effective due to availability.

Explanation:

Aluminum is the most abundant in the Earth's crust with good thermal and electric properties. It is soft, malleable ,ductile and lighter making it a vital metal in construction industry. An alloy of copper and tin, bronze is a better connector of heat and electricity ,commonly used in automobile industry for bearings and springs production. Steel a carbon alloy has applications in forging and automotive.

4 0
3 years ago
A rigid tank whose volume is 2 m3, initially containing air at 1 bar, 295 K, is connected by a valve to a large vessel holding a
bazaltina [42]

Answer:

Q_{cv}=-339.347kJ

Explanation:

First we calculate the mass of the aire inside the rigid tank in the initial and end moments.

P_iV_i=m_iRT_i (i could be 1 for initial and 2 for the end)

State1

1bar*|\frac{100kPa}{1}|*2=m_1*0.287*295

m_1=232kg

State2

8bar*|\frac{100kPa}{1bar}|*2=m_2*0.287*350

m_2=11.946

So, the total mass of the aire entered is

m_v=m_2-m_1\\m_v=11.946-2.362\\m_v=9.584kg

At this point we need to obtain the properties through the tables, so

For Specific Internal energy,

u_1=210.49kJ/kg

For Specific enthalpy

h_1=295.17kJ/kg

For the second state the Specific internal Energy (6bar, 350K)

u_2=250.02kJ/kg

At the end we make a Energy balance, so

U_{cv}(t)-U_{cv}(t)=Q_{cv}-W{cv}+\sum_i m_ih_i - \sum_e m_eh_e

No work done there is here, so clearing the equation for Q

Q_{cv} = m_2u_2-m_1u_1-h_1(m_v)

Q_{cv} = (11.946*250.02)-(2.362*210.49)-(295.17*9.584)

Q_{cv}=-339.347kJ

The sign indicates that the tank transferred heat<em> to</em> the surroundings.

8 0
3 years ago
Infinitivo de vivia kkk xd
blagie [28]

Answer:

pls put a question not random letters

Explanation:

8 0
3 years ago
Pipe Diameter and Reynolds Number. An oil is being pumped inside a 10.0-mm-diameter pipe at a Reynolds number of 2100. The oil d
alexdok [17]

Answer:

The velocity in the pipe is 5.16m/s. The pipe diameter for the second fluid should be 6.6 mm.

Explanation:

Here the first think you have to consider is the definition of the Reynolds number (Re) for flows in pipes. Rugly speaking, the Reynolds number is an adimensonal parameter to know if the fliud flow is in laminar or turbulent regime. The equation to calculate this number is:

Re=\frac{\rho v D}{\mu}

where \rhois the density of the fluid, \mu is the viscosity, D is the pipe diameter and v is the velocity of the fluid.

Now, we know that Re=2100. So the velocity is:

v=\frac{Re*\mu}{\rho*D} =\frac{2100*2.1x10^{-2}Pa*s }{855kg/m^3*0.01m} =5.16m/s

For the second fluid, we want to keep the Re=2100 and v=5.16m/s. Therefore, using the equation of Reynolds number the diameter is:

D=\frac{Re*\mu}{\rho*v} =\frac{2100*1.5x10^{-2}Pa*s}{925kg/m^3*5.16m/s}=6.6 mm

8 0
3 years ago
3. In order to obtain your commercial driver's license (CDL) you must first:
Murljashka [212]
A and C is the answer to the question. Be 15 years old & get a permit
8 0
3 years ago
Other questions:
  • Laws that protect businesses involve
    10·1 answer
  • Who can work on a fixed ladder that extends more than 24 feet?
    11·1 answer
  • A heat engine receives heat from a heat source at 1453 C and has a thermal efficiency of 43 percent. The heat engine does maximu
    11·1 answer
  • 1. Using a typical frequency value for the initiating event and PFD values provided in class lectures, estimate the mishap or co
    6·1 answer
  • Piping layout carrying liquid water at 70°F at a volumetric flow rate of 0.2 is composed of four sections of 4-in. Diameter stee
    12·1 answer
  • Air is compressed in a well insulated compressor from 95 kPa and 27 C to 600 kPa and 277 C. Use the air tables; assume negligibl
    11·1 answer
  • Which one of the following is not an economic want?
    6·1 answer
  • Question Completion Status:
    6·1 answer
  • A jointed arm robot can rotate on the following 6 axes?
    8·1 answer
  • Two solid yellow center lines on a two-lane highway indicate:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!