Question
(c++)ShowTickets Class using c++ Description(this one is showtickets instead of showticket) A theatre sells seats for shows and needs a system to keep track of
(c++)ShowTickets Class
using c++
Description(this one is showtickets instead of showticket)
A theatre sells seats for shows and needs a system to keep track of the seats they have sold tickets for. Define a class for a type called ShowTickets.
The class should contain a collection field for the rows, seat numbers, and whether the tickets have been sold or not. Your class only needs to support 10 sold tickets. Assume a ticket you have not referenced before has a sold status of false.
Include the following member functions:
- A function to check if the ticket has been sold with this signature: bool is_sold(string row, string seat);
- A function to update the ticket status to sold with this signature: void sell_seat(string row, string seat);
- A function to print the row, seat number, and sold status delimited by a space with this signature: string print_ticket(string row, string seat);
An example use of your class follows:
int main () { ShowTickets myticket; if(!myticket.is_sold(AA,101)) myticket.sell_seat (AA,101); cout << myticket.print_ticket(AA,101) << endl; cout << myticket.print_ticket(AA,102) << endl; return 0; }
The output from this sample would be:
AA 101 sold
AA 102 available
File Name
showtickets.h
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started