How to create a driver file theaterreservationdriver

Assignment Help Computer Engineering
Reference no: EM1331342

Implement a simple seat reservation system for a theater in C++. The seats in the theater will be represented with a two dimensional array. The closer the seats are to the stage, the more expensive the seats are. Moreover, within a row, the seats at the center shall be more expensive.

Use a simple algorithm to assign costs to seats. The seats in one row cost $10 more than the seats in the previous row. Within a row of n seats, the first and last n/4 seats should be $5 cheaper than the rest of the seats.

The following charts are examples of the expected costs of seats:

40 45 45 40
30 35 35 30
20 25 25 20
10 15 15 10

To do so, create a class TheaterReservationSystem having the following members:

A constructor taking two int constants: rows and seatsPerRow.

A function member int computeCost(int row, int seat). This function will calculate the cost of the seat based on the row and seat number as described above.

A function member bool reserveSeat(int cost). This function will reserve the first available seat of the specified cost if there is one. If the program finds a seat of the specified cost, the function shall return true. Otherwise, the function shall return false.

A function member bool reserveBestSeat(int lowestCost, int highestCost). This function will reserve the best seat available within the specified cost range. One seat is considered better than another if either it is closer to the stage or it is in the same row but in the center of the row.

A function member void displaySeatsCost(). This function will print to the standard output a matrix containing the cost of the seats.

A function member void displaySeats(). This function will print to the standard output a matrix showing which seats are reserved and which seats are not.

A data member m_seats of type bool[][].

Create a driver file TheaterReservationDriver. In this file create two constants int: seats and seatsPerRow. Upon executing the driver, it will create an object TheaterReservationSystem passing seats and seatsPerRow to its constructor. The program shall display the following menu:

Enter 1 to reserve a seat

Enter 2 to reserve the best seat available

Enter 3 to display seats cost

Enter 4 to display reservations

Option 1 will prompt the user for a cost and it will invoke function reserveSeat. Option 2 will prompt the user for a cost range and it will invoke function reserveBestSeat. These two options shall display an appropriate message indicating whether the reservation could be made or not. Options 3 and 4 will invoke displaySeatCost and displaySeats respectively.

Reference no: EM1331342

Questions Cloud

Reduce the defection rate : Today, companies are increasingly concerned about customer defection. There are three main steps a company can take to reduce the defection rate.
Company pays in sales person on the commission basis : make a C++ program that uses a "While" statement to input each salesperson's gross sale for last week and calculates and displays that salesperson's earnings. Process one salesperson's figure at a time.
Assume the utility function is not the square root : Assume the utility function is not the square root of income but instead, utility is linear in income.
Customs modernization and informed compliance act : What applicable rule and fact(s) should apply in this dispute? Customs Modernization and Informed Compliance Act?
How to create a driver file theaterreservationdriver : use a simple seat reservation system for a theater in C++. The seats in the theater will be represented with a two dimensional array. The closer the seats are to the stage, the more expensive the seats are. Moreover, within a row, the seats at the..
Alternative hrm practices : Show one or more conflicting practices you have experienced and recommend one or more alternative HRM practices that could appropriately minimize, or even eliminate, the conflict. Explain in detail.
Elucidate difference among the consumption of a free good : Elucidate the difference among the consumption of a free good and a good that is not free.
What is strategic management : What is strategic management? What role does strategic management play in the hospitality industry?
Elucidate the roles played by total utility : Elucidate the roles played by total utility and marginal utility.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Generating the program from the given structure

struct info student[500]; Utilizing the provided structure above, generate the program statements.

  Briefly explain the difference mesh, bus, ring, and star top

Briefly explain the difference, including advantages and disadvantages Ethernet, Token Ring, FDDI, and Wireless.

  The advantages and disadvantages of using functions

Show how you might write the "case" statement using only the "if" statement in its place an actual case statement. Hint: Nested if statements. Explain your code.

  Decribe each of the algorithms as to there stability

A sorting algorithm is stable if two data items having the equal value are not rearranged with respect to each other at any stage of the algorithm. decribe each of the algorithms as to there stability

  Query using an update statement

Here is issue, a table namedPoints varchar(81) has values stored in a column named Point. There are two columns in the Points table, X and Y.

  How to develop a problem definition

How to develop a problem definition

  Write a program based on encryption scheme

Write a program based on encryption scheme.

  Implementing the java application

Write down a Java application which enables a user to enter 10 numbers (double precision) into an array and then sorts and shows the numbers from lowest to highest.

  Evaluates and contrast tcp and ud

Describe the need for the Transport Layer. Recognize the role of the Transport Layer as it provides the end to end transfer of data between applications.

  Write java syntax that declares a 1d integer array

Write Java syntax that declares a 1D integer array. Instantiate and initialize the array from Q#1 with values: 5, 3, 5, 7,

  How to utilize data mining tools and techniques

How to utilize data mining tools and techniques

  Write down the data in a text file

Write down the data in a text file. Ask users to put in their annual income for 3 years.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd