Well, sea-creature fans, the plans for the new Summerville SeaWorld™ are well under way, and construction of the central attraction has already started. Now, you must prepare for a different sort of requirement: we need some way to automate and track ticket sales at the different entry points around the park. We’ll concentrate on selling tickets for the main attraction: the proposed Porpoise Pond. (I just had to get that in one more time J)
Your program will need to control, manage, and track all the ticket sales. Eventually, it will be operating on all the ticket sales computers; but we’ll just concentrate on getting it working on one computer for now! There are going to be three categories of tickets to track: free admission, juniors, and adults. Toddlers five and under will be allowed in for free; but of course we still need to track those, since there are limited seats for each show. Juniors, those between the ages of 6 and 16, will be charged $7.50 per ticket; and anyone over 16 will be charged the adult price of $11.50 per ticket.
Since there are only a certain number of seats in the arena, you will need to set up your repetition structure to terminate when all the seats are sold. To make the program a bit easier to manage and troubleshoot, I want you to use a named constant—call it MAX_SEAT_COUNT—and initialize it to the actual number of seats in the arena. As long as the total number of seats sold is less than this number, then keep selling them. When the number of tickets sold equals or exceeds this number, then stop. (There will also be an option for the user to quit. Read on.)
You don’t have to worry about the total number of tickets going over MAX_SEAT_COUNT while you are in the midst of one individual sale (one input). If, during the last entry, we end up selling a few too many seats, then we will just trot out a few portable chairs and space them out for the overflow. But you should not let anyone try to purchase more tickets after the count has met or exceeded the MAX_SEAT_COUNT. (The intent here is to simplify your logic. Suppose someone asks for 9 seats and there are only 6 left, just sell them 9 and check when you get back to the top of the loop.) (Hint: for troubleshooting and debugging, you will probably want to set MAX_SEAT_COUNT rather low. That’s the great thing about using a named constant: you can change it so easily. Make sure you check your program with a reasonably-sized number also. When I grade your program, I will change your MAX_SEAT_COUNT to a different value.)
When the program starts up, just provide the usual introduction, present your menu, and then start asking for ticket sales. Make sure your menu is a nice, simple one to choose from. The people selling tickets will be our employees, but they won’t be programmers, so make sure then can’t mess up any ticket sales!
The ticket menu needs to have four possible options: the three different types of tickets—toddlers (or free tickets), juniors, and seniors—as well as an option to quit. If the choice entered is incorrect, simply inform the ticket seller and ask for another selection. Why an option to quit? Normally, we wouldn’t expect anyone to quit the program before all tickets are sold. But in case we have to shut down a ticket booth early, we will need to be able to stop the program. So, the program needs to handle that eventuality and provide the final report even though some tickets were left unsold. (Hint: this means that you will need make two tests in the while condition: one to test for the user entering the quit value, and another to test for selling all the tickets. Of course, that means you will need to use either the AND or the OR operator to connect them, depending on how you write the two conditions.)
Each time through the loop, you should only sell one type of ticket: toddler, junior, or adult. (This is to simplify your design and coding!) But you may need to sell multiples of them. So, after requesting the type of ticket they want to purchase, ask how many they want. The buyer can purchase (or get free) a maximum of 10 tickets of one type. This means that, after inputting how many they want to buy, you will need to test that number and restrict it to a max of 10. If they want more than 10, simply sell them 10, no more! You don’t need to ask them again: just tell them 10 is the max, and that’s what they get.
Of course, you will be accumulating appropriate totals for the end of the program, so make sure your program takes care of those needs inside your loop also.
Now for the good part! We are going to spread discount coupons all over the local papers to entice customers to head our way! (In fact, since this promotion will go on for the foreseeable future, you need to build it permanently into your program.) So, just before you collect the user’s moolah, you’ll need to ask them if they have a discount coupon. All discounts will be the same: 25% off their total cost. If they hand you a coupon, reduce their ticket cost by 25%. (For your final total dollar sales, be sure to add the reduced charge, not the original charge.)
For each individual ticket sale (one time through your loop) display the type of ticket they are buying, the number they are buying, and the cost for the ticket(s). (If the cost is the discount cost, only show that—not the original cost.) The ticket booth operators need to see that information so they collect the correct amount from everyone!
Once all the tickets have been sold, or the user decides to select quit, clear the screen and then display the final report. (A sample final report is at the end of these directions.) Report the following at the end of the program:
Ø current maximum seat count
Ø total number of tickets sold overall
Ø total numbers of each ticket type (toddler, junior, and adult) sold, individually
Ø the number of “extra” tickets sold, if applicable. That is, if we went over the MAX_SEAT_COUNT, report that. We’ll track that for each show and decide if we want to do anything about it. Perhaps we can increase the seat count just a bit!
Ø total dollar sales for all tickets
Your final results must be laid out in a business-like report with headings, etc. A simple bunch of statements, like “Total number of tickets sold: 1345” will not be acceptable. See the next page for an example report.
This C++ solution should be Program5 Solution name. Zip the solution for submitting, as usual.
TURN IN: a data dictionary for this program, a complete flowchart, and the zipped solution directory. Submit everything using the Dropbox in D2L.
Urgent Note: if it even occurs to you to try to write this program without planning it all out, then you are seriously missing the point of this class. I have included quite a few details that you can’t possibly get right without thinking them all through and planning them out very carefully. You don’t necessarily have to finish a perfect flowchart before coding, but you had better draw some semblance of a plan first, and use it to figure out when each requirement has to appear and be taken care of!!
SAMPLE FINAL REPORT
TICKET SALES REPORT FOR DATE: 10/29/2011
SEAT CAPACITY EXTRAS TOTAL SOLD
2200 3 2203
TODDLERS JUNIORS ADULTS
472 922 809
GROSS FOR TODAY: $16,218.50
(NOTE: the date is optional. See the Extra Credit.)
EXTRA CREDIT (5 pts)
Your final report is really summarizing the results for a certain date of operation. So, it should be stamped with the date, don’t you think? In the header for the report show the current date, similar to what is shown in the example report above. But don’t code the actual date; obtain it from the computer as the program is running. Use the following procedures.
//You’ll need to include a library, declare a character array, and call a function:
//Declare an old-fashioned C string
//Call the function _strdate_s to get the date and store it in the string
_strdate_s ( tmpbuf );
//Now, you can just output the variable tmpbuf anywhere you want.