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

  Using powerpoint, word, visio or any other graphical editor

Using Powerpoint, Word, Visio or any other graphical editor that allows you to create shapes and arrows, create a simple flow chart  that provides the functionality for this pseudocode: Write "Enter the price in dollars: " Input Price

  Program which asks the user for due date of next assignment

Write a program which asks the user for due date of the next assignment (hours, minutes). Then print number of minutes between the current time and the due date in format.

  Write a program in which the program prints out

Use (switch statement) to write a program in which the program prints out the input (single character) if the character is not '2','t', or 'w'. Use 'default' and 'break' wisely.

  A website for a popular international music store

Imagine that you are building a Website for a popular international music store. The owner wants to play an audio clip featuring the musical instrument of the month on their home page. Determine how you would add audio to the page so that it is compa..

  Write a program that reads full names one per line

Write a program that reads full names, one per line, and then prints them in the standard telephone directory format. For example, the input Johann Sebastian Bach George Frederic Handel Carl Phillipp Emanuel Bach Joseph Haydn.

  Write a c function to find the norm of a matrix

Write a C function to find the norm of a matrix. The norm is defined as the square root of the sum of squares of all elements in the matrix. Write your own code please.

  Presented a number of recurrence relations

For this problem set, you will be presented a number of recurrence relations and asked to state their actual time complexity, showing your work in the process.

  Using visual c++ and your opengl configured environment

Using Visual C++ and your OpenGL configured environment, write an application that uses OpenGL Raster transformations to draw a triangle of your choice of size, location and color, and then rotate that triangle by 90 degrees and scale it by a fact..

  Appropriate structure to use to program the statement

A home improvement store is giving a discount of 20% on all purchases of more than $250. Which of the following is the appropriate structure to use to program the statement

  Determine the size of the square

1. An open box is to be made from a square piece of cardboard whose sides are 17 in long, by cutting squares of equal sizes from the corners and bending up the sides. Determine the size of the square that is to be cut out so that the volume may be ma..

  Program that can serve as a simple calculator

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..

  Implement a stack class for stacks of ints

Implement a Stack class for stacks of ints. Include a default constructor, a destructor, and the usual stack operations: push(), pop(), isEmpty(), and isFull(). Use an array implementation.

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