Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Context A movie theater is testing a ticket purchasing system that allows customers to select their seat in the theater at the time of purchase.

image text in transcribedimage text in transcribed

Context A movie theater is testing a ticket purchasing system that allows customers to select their seat in the theater at the time of purchase. This movie theater has 30 available seats in each theater (numbered 0-29) and once a seat has been selected by one customer, it is marked as booked and cannot be selected by anotnertmer. Fer the purposes of this simulation, we will assume that patrons are net willing tc purchase a ticket if their prefered seat is unavailable, so they will leave without buying a tickst Problem The purpase of this program is to determine whether this seat selection system is efficient In order to test efficiency, the manager of the theater has sel an acceplable success rate to compare the observed suocess tale against. succ2ss rate- of cP-eted transactions (where the dcerca seat s not a-ready booked) / : If the observed supcess rate is less than the acceptable success rate, the simulated set of transactions fails to meet the minimum requirements for eiciency To begin the simulation, the user will input a number of iterations to be evaluated as well as the number of attempted transacticns per iteration. terations can be thought of as showtimes in a given theater. Each iteration begins with 30 empty seats wnich can then be bockec by customers We will simulate the selection of seats by using the rando runction to generate random numbers ranging frem 0 to 29 corresponding to seats in the theater. In order to use the rand0 function you must first incluce stdlib h and call the srand0 function and pass a seed value to it. The seed value will be input by the user. Ex int seecval: srandisedva1) Input Tne user wl inpu: 4 values . The number of iterations/showtimes to be evaluated The number of transactians attempted for each iteration . The acceptable success rate . The seed for random number generaton You will be expected to validate all four inputs All four values should be non-negarive and the success rate should be between 0 and 1 (inclusive). Iterations must be greater than zero. If one of the four input values is ot valid, the cutput should be Error. Invalid paramatar: Output Your pregrar shculd output: . The acceptable success rate determined oy the user .The average attempted sales per iteration average completed sales per iteratian The observed suocess rate (number of total completed sales number of total attempted sales) Whether or not the observed success rate is acceprable . 4151 Homework2 0 100 ACTVITY main.cpp Load defauit template... int no a douLe successRate ad other variabies necessary for your pregran 12 cin iterations, urber of iterations to be evaluoted 24 cinsucessnate 1s cin sed; sd for randcn ueber generation Nalidat input // rt wyder d stsrt it-rat cr1% tvery iterstinn ot the sinalation starts by setting a11 seats tn erpty Corplete inal output: 27 za cout "Average coroleted sties: " cout "Observed success rate: //cceplete if statenent to test success rate 31 1FC cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

denigration of emotional outbursts; being reserved;

Answered: 1 week ago