Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instruction: Write a C++ program that implements a database for a theater. The database consists of a collection of transactions (You can call the database

Instruction: Write a C++ program that implements a database for a theater. The database consists of a collection of transactions (You can call the database Transactions). Whenever a customer buys a ticket to a show, a transaction will be created in the system and stored in the database. Use structures to declare the tickets and transactions. Enum should be used for declaring the types of shows available in the theater. Please make sure to implement all the fields mentioned below in the structures.

A Ticket should contain the following fields (Hint: Use Structures for transactions):

Shows name

Ticket ID (e.g. 1234)

Show type (Hint: use enum. Ex: Movie, Play, Musical, etc.)

Show time (Type char, ex: 2:30)

Discount (ex: 12.5%)

A Transaction contains the following fields

Ticket ID

Number of tickets

Date (ex: 03/10/2017)

The database Transactions is a collection of all the transactions made.

Please follow the following steps sequentially:

1. Create an enum showType, this will contain all the different shows which can run in a theater, eg: Movies, play, musical, etc.

2. Create a structure ticket in the below format. For complete list of members of struct look at page 1 of the specifications.

typedef struct Ticket {

int Tid,

char name[50], . . .

};

struct Ticket tik;

3. Create a structure for containing the list of transactions. To include the transactions, use the ticket id variable as a reference.

typedef structTransaction{

int number;

char date[10];

. . .

};

struct Transaction tr;

4. Your program should contain three functions One will print the below given menu() on the screen, the second function is createTicket() and the third function is addTransaction(). Please make sure to include the function prototypes before main(). Write a main() function where the functions are called. Menu function should be written to allow the user to select options listed.

a. Create a Ticket and print amount.

b. Add Transactions to database

c. Exit

5. The function createTicket() should read in the structure variables from the user. Use, a variable for finding out if the user has an applicable discount. If yes, then read in the discount percentage or else equate the discount to 0. After reading in all the variables, compute the price and display it to the user. And, then display that the transaction has been successfully created. 6. The function addTransaction() will ask the user if they want to save the transactions for the day in the database. If the answer is yes then it will save the days collections in the database along with the date and time. (This function will be extended next week when you will be asked to write the information in a file.) So for this week just print all the data on the screen.

6. The function addTransaction() will ask the user if they want to save the transactions for the day in the database. If the answer is yes then it will save the days collections in the database along with the date and time. (This function will be extended next week when you will be asked to write the information in a file.) So for this week just print all the data on the screen.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago