Question: Need the code in c++ ASAP Applications like Fandango allow customers to buy movie tickets, exchange and refund tickets, and earn member perks. For everyone

Need the code in c++ ASAP

Applications like Fandango allow customers to buy movie tickets, exchange and refund tickets, and earn member perks. For everyone who loves to go to a movie theatre to see movies, these applications can be convenient. This lab takes the idea of an application like this, but applies it in a smaller context. Imagine you are creating a program to be used at a small movie theatre that only has one movie showing once a day. This lab will implement the functionality of selling tickets to customers for this single movie. It will print receipts for purchased tickets, tell the user whether there are enough seats to fulfill an order, and tell the user if the movie is sold out. Although this lab is in a smaller context, the code will follow algorithms similar to those used to implement the same functionality in larger application such as Fandango.

Detailed Information

Your program MUST use the variable and constant declarations below, Note the inline comments for the variables these are examples of good inline comments. Use them, also. You may initialize the movie title, the rating, the start hour and minute and the ampm variable to different values if you like.

Before the main function, use global constants. Do not change the values of these constants.

const double TICKET_PRICE = 9.95;

const double TAX_RATE = 0.095;

Declare the following variables inside the main function. You may change the values of the movie name, the rating and the start time. You may add additional variables.

// number of empty seats available for purchase

int seatingLeft = 300;

// movie title

string movieName = "The Best Movie Ever";

// Motion Picture Association of America rating

string rating = "PG-13;

int startHour = 4; // start time in 12-hour clock

int startMinute = 30;

char ampm = 'P';

int tickets; // how many tickets user wants to buy

double subtotal, tax, total; // user's receipt values

Note from Sample Execution 2 below that the program may issue the following error messages.

  • If the user enters a negative number of tickets (where _____ is the invalid number the user entered such as -1): Invalid number of tickets: ______
  • If the user tries to buy more tickets than there are seats left (where ________ is the number of seats left): Could not process your request. There are only _____ tickets left
  • If the user tries to buy tickets but there arent any left: Im sorry. Were SOLD OUT.

You may assume that when the program asks the user for a number, the user will enter a number. For example, when prompted for the number of tickets, the user wont enter abc. We havent learned how to handle a situation like that yet, so we wont write code for it and we wont test it (since theres no code to test for this situation).

Sample executions

Sample Execution 1

Welcome to My Theaters Ticketing Program.

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 2

Tickets purchased: 2

Subtotal: $19.90

Tax: $1.89

Total: $21.79

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 5

Tickets purchased: 5

Subtotal: $49.75

Tax: $4.73

Total: $54.48

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 0

Thank you for using My Theatres Ticketing Program.

Sample Execution 2

Welcome to My Theaters Ticketing Program.

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? -1

Invalid number of tickets: -1

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 400

Could not process your request. There are only 300 tickets left.

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 300

Tickets purchased: 300

Subtotal: $2985.00

Tax: $283.57

Total: $3268.57

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 1

I'm sorry. We're SOLD OUT.

Today we are showing: The Best Movie Ever rated PG-13 at 4:30 PM

How many tickets (0 to end)? 0

Thank you for using My Theatres Ticketing Program.

Relevance Questions

This lab requires the use of selection statements in order to decide whether to print one of the messages above. It also requires the use of loops to make it do something over and over again. Most programs of any significant size use loops because they need to do things more than once.

  1. List two functionalities we could add to make our application more useful. You dont have to know how to write the code yet, so use your imagination.

Rubric

For any credit on this lab, the program must use selection statements and loops, and it must not alter the constants listed in the assignment except where indicated.

  • (10 points) Comments and style
  • (4 points) Relevance questions
  • Program correctness
    • (5 points) Correctness of literal output such as How many tickets (0 to end):
    • (5 points) Formatting of numeric data
    • (36 points) Correctness of numeric data in receipt
    • (10 points) Invalid tickets message when the user enters a number of tickets such as -1
    • (10 points) Error message when user attempts to buy more tickets than there are seats left
    • (10 points) Error message when the theatre is sold out
    • (10 points) Miscellaneous

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!