Design an algorithm to assign costs to seats.

Assignment Help C/C++ Programming
Reference no: EM13936769

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: EM13936769

Questions Cloud

Very important component of your system : The user interface is a very important component of your system. In this assignment you are first asked to read and understand a popular set of usability heuristics. Readings (Jakob Nielsen is a very renowned usability expert):
What proportion of the population are carriers : Imagine a population of 10,000 humans living on an isolated island. Every generation, an average of one individual is born with cystic fibrosis, a fatal genetic disease caused by a recessive allele, What are the frequencies of the dominant, and rec..
Introductory background to the yeppoon show : 1. Give an introductory background to the Yeppoon show. 2. Conduct a literature review of about 600 words about customer satisfaction, in particular at shows.
Strategic agility in the context of uk financial service : A research on Strategic Agility in the context of UK Financial Services Industry. Define strategic agility. Assessing the current levels of strategic agility. Are there any internal or external barriers to agility.
Design an algorithm to assign costs to seats. : 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 ..
Calculate the economic order quantity for component rb : Calculate the economic order quantity (to the nearest unit) for component RB. Briefly describe the circumstances in which Jane plc should consider having a buffer stock of component RB.
How has the use of recombinant dna technology : How has the use of recombinant DNA technology added to the treatment of the disorder? How has the treatment affected the long-term quality of life and long-term outlook of people with the disorder?
Contemporary internal information system : You should complete the following tasks for the given business scenario. You are one of a team of newly graduated software engineers working on a project to build the infrastructure of an organization with an intensive and data sensitive internal ..
Annual show in yeppoon for the show holiday : The Yeppoon and District Show Society Inc organizes an annual show in Yeppoon for the Show Holiday. This year it was organized on the 6th and 7th June 2015 and attracted over 10000 people.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c++ program to calculate the gpa of 5 courses

Write a C++ program to calculate the Gpa of 5 courses. When users enter the grades and credits of the courses from the keyboard

  Write a program to perform statistics calculation

The results should add the sums, the lengths and determine which of the two are the largest and the smallest of the new statisticians form the two inputs. ex statistician3 largest is the

  Bare in mind this is a program

Bare in mind this is a program with the audience being lawncare and landscaping people. So the events will generally be to know how often a client wants their lawn mowed.

  Create a boolean function that computes

Create a Boolean function that computes the value of a factorial for values up to including 10. Include comments about how to use the function and describing how it works.

  Program which converts fahrenheit to centigrade

Design, create, and test a program which converts degrees Fahrenheit to degrees Centigrade (Celsius). The program must contain one main program and 3 functions: F2C() and C2F() and instructions()

  Code to implement a staque

Write a C++ code to implement a Staque. Since the data structure is all about inserting and deleting numbers, it would be a good option to use a linked list to implement Staque.

  Write an abstract class carbon footprint

Using an abstract class with only pure virtual functions, create three small classes unrelated by inheritance---clases Building, Car and Bicycle.

  Solution to the quadratic equation

The program should allow the user to input the particular integer coefficients of the quadratic equation and properly output either real or complex number solutions for the roots of the equation

  How does the choice affect the user of the class

Write a partial C++ class definition not implementation that contains the public interface of the Date class described in Exercise R9.2.

  Display a year-by-year depreciation schedule

Create GUI screen interface that accepts input and shows output and resize the GUI screen & the list box to best fit the output displayed

  Write a c++ program that asks the user for a radius r

Write a c++ program that asks the user for a radius r. The program must include a function called calcwradius that accepts the value of the radius r, and calls the function pi shown below.

  Demonstrate your code compiles and runs for a test case

Use a For loop to iterate through the array and input the values. Demonstrate your code compiles and runs for a test case of your choice.

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