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
Assume you have four fins, each with a mass of 8.0 grams. What is the total weight of these four fins? (Hint: watch your units!)
soldier1979 [14.2K]
The answer is 32.0 grams
7 0
2 years ago
Engine oil flows through a 25‐mm‐diameter tube at a rate of 0.5 kg/s. The oil enters the tube at a temperature of 25°C, while th
Elodia [21]

Answer:

a) the log mean temperature difference (Approx. 64.5 deg C)

b) the rate of heat addition into the oil.

The above have been solved for in the below workings

Explanation:

3 0
3 years ago
What application of bioengineering uses principles of electronics and computer science to design products?
Flauer [41]

The application of electro bioengineering uses principles of nick and computer science to design products is application of electrical engineering principles to biology, medicine, conduct, or health.

<h3>What is Bioelectronics?</h3>
  • Bioelectronics is the application of electrical engineering principles to biology, medicine, conduct, or health.
  • It advances the fundamental concepts, creates knowledge for the molecular to the organ techniques levels, and develops creative devices or methods for the deterrence, diagnosis, and treatment of disease, for patient rehabilitation, and for improving health.
  • Bio electromagnetics, instrumentation, neural networks, robotics, and detector technologies are some of the disciplines necessary to develop new knowledge and creations in this area.
  • A keystone of this research area is the building of and real-world devices and systems.
  • Onsite facilities for prototyping and testing instrumentation systems, fabricating and measuring the performance of implantable devices, and making robotic prostheses, are readily available.
  • New detectors and sensor arrays are microfabricated in a 2,000 sq ft cleanroom.

To learn more about Bioelectronics, refer to:

brainly.com/question/21819443

#SPJ4

4 0
2 years ago
Write an ALP to separate odd and even numbers from an array of N numbers; arrange odd
Marta_Voda [28]

Below is the program to separate odd and even numbers                                  

<u>Explanation</u>:

<u>L1:</u>

         mov ah,00

         mov al,[BX]

         mov dl,al

         div dh

         cmp ah,00

         je EVEN1

         mov [DI],dl

         add OddAdd,dl

         INC DI

         INC BX

         Loop L1

         jmp CAL

    <u>EVEN1:</u>

         mov [SI],dl

         add Even Add,dl

         INC SI

         INC BX

         Loop L1

    <u>CAL:   </u>  

         mov ax,0000

         mov bx,0000

         mov al,OddAdd

         mov bl,EvenAdd

         MOV  ax,4C00h

         int 21h

end

The above program separates odd and even numbers from the array using 8086 microprocessor. It has odd numbers in 2000h and even numbers in 3000h.

6 0
3 years ago
Water, initially saturated vapor at 4 bar, fills a closed, rigid container. The water is heated until its temperature is 440°C.
lawyer [7]

Answer:

Heat required (q) = 471.19kj/kg

Explanation:

Find attached below solution to problem

7 0
3 years ago
Other questions:
  • Suppose you have a 9.00 V battery, a 2.00 μF capacitor, and a 7.40 μF capacitor. (a) Find the charge and energy stored if the ca
    13·2 answers
  • For a steel alloy it has been determined that a carburizing heat treatment of 7 hour duration will raise the carbon concentratio
    12·1 answer
  • A mass weighing 22 lb stretches a spring 4.5 in. The mass is also attached to a damper with Y coefficient . Determine the value
    12·1 answer
  • Radioactive wastes generating heat at a rate of 3 x 106 W/m3 are contained in a spherical shell of inner radius 0.25 m and outsi
    7·1 answer
  • For a body moving with simple harmonic motion state the equations to represent: i) Velocity ii) Acceleration iii) Periodic Time
    11·1 answer
  • Are designed to make it easier for employees to get health and safety Information about
    11·1 answer
  • A minor road intersects a major 4-lane divided road with a design speed of 50 mph and a median width of 12 ft. The intersection
    13·1 answer
  • Hi, everyone I'm a high school student in Texas. My engineering teacher is asking us to find an active engineer to complete a li
    5·1 answer
  • 2. A F-22 Raptor has just climbed through an altitude of 9,874 m at 1,567 kph when a disk
    8·1 answer
  • Select the correct answer. Which of the following devices is a simple machine? A.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!