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

  Make an idef1x e-r diagram

The scenario is that the Public Affairs Office at Highline University receives requests for speakers on particular topics. To be capable to respond to such request, that office wants to build a database.

  How to make an xml file in visual studio

How to make an xml file in Visual Studio

  Distributed database

A distributed database is also termed as the Replicated Virtualized Rendered Concatenated database.

  Add items to the arraylist

Add items to the ArrayList, one at a time, based on user typed input. The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user would be able to continue to add items to the ArrayList until they just hit e..

  Assembly program

Specify the assembly language program (of equivalent binary instructions), created by a compiler from following pseudo-code program. Suppoose all variables are integer.

  Computing roots of the function f

The best known iterative method in order compute the roots of the function f (that is, the x-values for which f(x) is 0) is Newton-Raphson approximation.

  Program for converting infix expressions into postfix form

Write a program which will transform the infix expressions into the postfix form and then determine the resulting postfix expression.

  Local v/s network printers

Write down a paper explaining the Windows Printer Model for Server 2008. Explain the local v/s network printers and how to decide which printers to deploy.

  Providing the summary of current event article

Current event article is based upon how an expert’s deposition helped the case at trial. Include the specification on how deposition was delivered and what was done in order to assure that it was given truthfully and concisely.

  Evolution of software and hospital improvements

Discuss how the hospitals are improving the efforts along with their supply chain through the evolution of software.

  Organizational information processing theory

What is organizational information processing theory, explain its concepts and what do you meant by creating the slack resource, make the lateral relationship.

  Find significant inversions in the input sequence

offer an O(n*log(n)) algorithm to count the number of significant inversions in the input sequence.

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