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
(a) For BCC iron, calculate the diameter of the minimum space available in an octahedral site at the center of the (010) plane,
Romashka-Z-Leto [24]

Answer:

a) diameter available = 0.0384 nm

b)The space  is smaller than the carbon atom which has a  radius of  0.077 nm and this simply means that the carbon atom will not conquer these sites

Explanation:

For BCC iron

From Appendix B given,select the lattice parameter ( a ) as = 0.2866 nm

The BCC iron has 4 atomic radii and therefore the body diagonal length = a(3)^\frac{1}{2}

expressing the atomic radius of the BCC iron

4r = a(3)^\frac{1}{2}

insert the value of (a) from appendix B which is = 0.2866 nm

4r = 0.2866 nm (3)^\frac{1}{2}

therefore  r =  0.4964 nm / 4 = 0.1241 nm

Refer again to appendix C given select the atomic radius of the BCC iron as = 0.1241 nm   assuming the atomic radius of the iron are the same

then the radius ratio = 0.62

Refer to the Figure 3.2 given, the amount of space required for an interstitial at the BCC position is between the atoms at the FCC position and also in this space there are two atoms that are equal to a radius of 0.2482 nm

The diameter of the minimum space available

d_{a} = a - r_{a}

r_{a}  = atomic radii = 0.2482 nm

a = 0.2666 nm

therefore

d_{a} = 0.2866 nm - 0.2482 nm = 0.0384 nm

comparing this to the diameter of a carbon atom

The space  is smaller than the carbon atom which has a  radius of  0.077 nm and this simply means that the carbon atom will not conquer these sites

7 0
3 years ago
Which battery produces more volts per cell, maintenance type or maintenance free ?
Sonja [21]
Double aa battery. It’s is a very high bolted battery that can power up a lot of things
7 0
3 years ago
A spherical balloon with a diameter of 9 m is filled with helium at 20°C and 200 kPa. Determine the mole number and the mass of
SIZIF [17.4K]

Answer:

<em>number of mole is 31342.36 moles</em>

<em>mass is 125.369 kg</em>

<em></em>

Explanation:

Diameter of the spherical balloon d = 9 m

radius r = d/2 = 9/2 = 4.5 m

The volume pf the sphere balloon ca be calculated from

V = \frac{4}{3} \pi r^3

V = \frac{4}{3}* 3.142* 4.5^3 = 381.75 m^3

Temperature of the gas T = 20 °C = 20 + 273 = 293 K

Pressure of the helium gas = 200 kPa = 200 x 10^3 Pa

number of moles n = ?

Using

PV = nRT

where

P is the pressure of the gas

V is the volume of the gas

n is the mole number of the gas

R is the gas constant = 8.314 m^3⋅Pa⋅K^−1⋅mol^−1

T is the temperature of the gas (must be converted to kelvin K)

substituting values, we have

200 x 10^3 x 381.75 = n x 8.314 x 293

number of moles n  = 76350000/2436 = <em>31342.36 moles</em>

We recall that n = m/MM

or m = n x MM

where

n is the number of moles

m is the mass of the gas

MM is the molar mass of the gas

For helium, the molar mass = 4 g/mol

substituting values, we have

m = 31342.36 x 4

m = 125369.44 g

m =<em> 125.369 kg</em>

3 0
3 years ago
Blank is common during exercise.
dsp73

Answer:

Sweat

Explanation:

As you exercise you respire and warm up due to energy. In turn, two things happen, blood vessels vasodilate (irrelevant to you) and sweat glands sweat more. this sweat then evaporates and cools down the body.

7 0
2 years ago
Against which type of economic structure does conflict theory argue?
alisha [4.7K]

Answer:

b) socialism

Explanation:

Conflict theory focuses on the competition between groups within society over limited resources. Conflict theory views social and economic institutions as tools of the struggle between groups or classes, used to maintain inequality and the dominance of the ruling class.

HOPE IT HELPS!!!!!!!!!

4 0
3 years ago
Other questions:
  • Please write the following code in Python 3. Also please show all output(s) and share your code.
    10·1 answer
  • Compute the acceleration of gravity for a given distance from the earth's center, distCenter, assigning the result to accelGravi
    9·2 answers
  • How many GT2RS cars were made in 2019
    7·2 answers
  • Determine size of a standard square key made of 1045 hot rolled steel for a 2 inch DIA shaft transmitting 100 HP at 500 rpm with
    12·1 answer
  • Rewrite the following loops, using the enhanced for an array of floating-point numbers. Write your code within comments
    6·1 answer
  • A correctly designed and installed air curtain can be used to prevent what
    12·1 answer
  • 25 pts!!!
    12·1 answer
  • There are 22 people in the classroom 12 are we
    5·2 answers
  • Atoms contain charged particles called___?
    6·1 answer
  • Flip-flops are normally used for all of the following applications, except ________. logic gates data storage frequency division
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!