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
5. Assume that you and your best friend ench have $1000 to invest. You invest your money
Bezzdna [24]

Correct question reads;

Assume that you and your best friend each have $1000 to invest. You invest your money in a fund that pays 10% per year compound interest. Your friend invests her money at a bank that pays 10% per year simple interest. At the end of 1 year, the difference in the total amount for each of you is:

(a) You have $10 more than she does

(b) You have $100 more than she does

(c) You both have the same amount of money

(d) She has $10 more than you do

<u>Answer:</u>

<u>(d) She has $10 more than you do</u>

<u>Explanation</u>:

Using the compound interest formula

A= P [ (1-i)^n-1

Where P = Principal/invested amount, i = annual interest rate in percentage, and n = number of compounding periods.

<u>My compound interest is:</u>

= 1000 [ (1-0.1)^1-1

= $1000

$1,000 + $1,000 invested= $2,000 total amount received.

<u>My friend's simple interest is;</u>

To determine the total amount accrued we use the formula:

P(1 + rt) Where:

P = Invested Amount (1000)

I = Interest Amount (10,000)

r = Rate of Interest per year (10% or 0.2)

t = Time Period (1 )

= 1000 (1 + rt)

= 1000 (1 + 0.1x1)

= $1100 + $1000 invested = $2100 total amount received.

Therefore, we observe that she (my friend) has $100 more than I do.

5 0
3 years ago
A steel bar is 150 mm square and has a hot-rolled finish. It will be used in a fully reversed bending application. Sut for the s
Xelga [282]

Answer:

See explanation

Explanation:

Given The bar is square and has a hot-rolled finish. The loading is fully reversed bending.

Tensile Strength

Sut: 600 MPa

Maximum temperature

Tmax: 500 °C

Bar side dimension

b: 150 mm

Alternating stress

σa: 100 MPa

Reliability

R: 0.999 Note 1.

Assumptions Infinite life is required and is obtainable since this ductile steel will have an endurance limit. A reliability factor of 99.9% will be used.

Solution See Excel file Ex06-01.xls.

1 Since no endurance-limit or fatigue strength information is given, we will estimate S'e based on the ultimate tensile strength using equation 6.5a.

S'e: 300 MPa = 0.5 * Sut

2 The loading is bending so the load factor from equation 6.7a is

Cload: 1

3 The part size is greater than the test specimen and the part is not round, so an equivalent diameter based on its 95% stressed area must be determined and used to find the size factor. For a rectangular section in nonrotating bending, the A95 area is defined in Figure 6-25c and the equivalent diameter is found from equation 6.7d

A95: 1125 mm2 = 0.05 * b * b Note 2.

dequiv: 121.2 mm = SQRT(A95val / 0.0766)

and the size factor is found for this equivalent diameter from equation 6.7b, to be

Csize: 0.747 = 1.189 * dequiv^-0.097

4 The surface factor is found from equation 6.7e and the data in Table 6-3 for the specified hot-rolled finish.

Table 6-3 constants

A: 57.7

b: -0.718 Note 3.

Csurf: 0.584 = Acoeff * Sut^bCoeff

5 The temperature factor is found from equation 6.7f :

Ctemp: 0.710 = 1 - 0.0058 * (Tmax - 450)

6 The reliability factor is taken from Table 6-4 for R = 0.999 and is

Creliab: 0.753

7 The corrected endurance limit Se can now be calculated from equation 6.6:

Se: 69.94 MPa = Cload * Csize * Csurf * Ctemp *

Creliab * Sprme

Let

Se: 70 MPa

8 To create the S-N diagram, we also need a value for the estimated strength Sm at 103 cycles based on equation 6.9 for bending loading.

Sm: 540 MPa = 0.9 * Sut

9 The estimated S-N diagram is shown in Figure 6-34 with the above values of Sm and Se. The expressions of the two lines are found from equations 6.10a through 6.10c assuming that Se begins at 106 cycles.

b: -0.2958 Note 4.

a: 4165.7

Plotting Sn as a function of N from equation 6.10a

N Sn (MPa)

1000 540 =aa*B73^bb

2000 440

4000 358

8000 292

16000 238

32000 194

64000 158

128000 129

256000 105

512000 85

1000000 70

FIGURE 6-34. S-N Diagram and Alternating Stress Line Showing Failure Point

10 The number of cycles of life for any alternating stress level can now be found from equation 6.10a by replacing σa for Sn.

At N = 103 cycles,

Sn3: 540 MPa = aa * 1000^bb

At N = 106 cycles,

Sn6: 70 MPa = aa * 1000000^bb

The figure above shows the intersection of the alternating stress line (σa = 100 MPa) with the failure line at N = 3.0 x 105 cycles.

8 0
3 years ago
HW6P2 (20 points) The recorded daily temperature (°F) in New York City and in Denver, Colorado during the month of January 2014
Maurinko [17]

Answer & Explanation:

function Temprature

NYC=[33 33 18 29 40 55 19 22 32 37 58 54 51 52 45 41 45 39 36 45 33 18 19 19 28 34 44 21 23 30 39];

DEN=[39 48 61 39 14 37 43 38 46 39 55 46 46 39 54 45 52 52 62 45 62 40 25 57 60 57 20 32 50 48 28];

%AVERAGE CALCULATION AND ROUND TO NEAREST INT

avgNYC=round(mean(NYC));

avgDEN=round(mean(DEN));

fprintf('\nThe average temperature for the month of January in New York city is %g (F)',avgNYC);

fprintf('\nThe average temperature for the month of January in Denvar is %g (F)',avgDEN);

%part B

count=1;

NNYC=0;

NDEN=0;

while count<=length(NYC)

   if NYC(count)>avgNYC

       NNYC=NNYC+1;

   end

   if DEN(count)>avgDEN

        NDEN=NDEN+1;

   end

   count=count+1;

end

fprintf('\nDuring %g days, the temprature in New York city was above the average',NNYC);

fprintf('\nDuring %g days, the temprature in Denvar was above the average',NDEN);

%part C

count=1;

highDen=0;

while count<=length(NYC)

   if NYC(count)>DEN(count)

       highDen=highDen+1;

   end

   count=count+1;

end

fprintf('\nDuring %g days, the temprature in Denver was higher than the temprature in New York city.\n',highDen);

end

%output

check the attachment for additional Information

8 0
3 years ago
Since the passing of the Utah GDL laws in 1999:
wlad13 [49]
The answer is b, I hope this helps you
7 0
3 years ago
HELP PLS
Angelina_Jolie [31]

Answer:

The correct option is;

B) Metamorphic Rocks

Explanation:

Zoisite, which is also referred to saualpite, is a metamorphic rock which is a hydroxy sorosilicate mineral formed from other types of rocks such as sedimentary, metamorphic and ingenious rocks in the process of their metamorphism under the presence high temperatures and pressures and mineral fluids which are hot

Zoiste is named after Sigmund Zois by Abraham Gottlob Werner in 1805 when Sigmund Zois sent Abraham Gottlob Werner the mineral specimen from Saualpe in 1805

6 0
3 years ago
Other questions:
  • Biologists use a sequence of letters A, C, T, and G to model a genome. A gene isa substring of a genome that starts after a trip
    5·1 answer
  • Convert 0.025 in into mm.
    11·2 answers
  • Indicate on a tensile curve such quantities as yield stress, Young's modulus, UTS, toughness, point of necking, point of fractur
    7·1 answer
  • What are cars manufactured with today that allows for quick stopping without the brakes locking up?
    5·1 answer
  • The base class Pet has attributes name and age. The derived class Dog inherits attributes from the base class Pet class and incl
    10·1 answer
  • Cite another example of information technology companies pushing the boundaries of privacy issues; apologizing, and then pushing
    9·1 answer
  • Safety-in engineering as with everything else is all about trying to maximize or create the hazards involved with what you are d
    6·2 answers
  • If the 2007 recession affected the green building materials market less seriously than other parts of the construction market, t
    12·2 answers
  • Please read and an<br><br> 3. Many Jacks use hydraullc power.<br> A) O True<br> B) O False
    13·1 answer
  • 5. A 15-nC point charge is at the origin in free space. Calculate V₁ if point P, is located at
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!