C++ Program



The main attraction of Summerville SeaWorldâ„¢ is no longer simply a proposition anymore:  the Porpoise Pond is a great hit with the local water-fun crowd!  Your planning was critical to getting the project off the ground, so to speak, and lots of grinning kiddies all wet.  Congratulations!  But only now has the boss discovered a missing link in the business plan:  a way to analyze the receipts and categorize exactly how well the attraction is doing.  Time for one more great C++ program.  This is sure to cement your reputation, again so to speak J, and ensure you will be in high demand by businesses all over the low country.


The company ticket sales information is all sent to a data file to record each day’s activity.  But since the data arrives electronically from approximately 7 – 10 sales booths, there is no way to record anything but the basic sales data.  No one has figured out a way to capture the summary data when a booth is shut down.  So, your program will access a daily sales file and work with the raw data.




You’ll need a copy of the data file to work with—the file’s name is  ssw-sales.dat.  Once you have your solution and your project created, place the data file into the project subdirectory (the same place that you see the .CPP file).  Note:  if you are working with the shell provided by your instructor, this will have been taken care of already.


Each record in the file contains data on one sale to one customer.  Here is a description of each of the fields for all records:


FIELD                      TYPE         DESCRIPTION                                                                EXAMPLES

Date                         string          Date coded as a string                                                    10/11/2010

Ticket type              char            Single character code for the type of ticket                ‘C’, ‘J’, ‘A’   (Child, Junior,Adult)

Ticket quantity      int               How many tickets purchased—all of the same type

Coupon                   char            If customer had a discount coupon                             ‘Y’ or ‘N’

Ticket cost              double        Actual cost of the ticket(s)


Each record is on a separate line, and fields are separated by a space.




For each record, display the following on one line:  a line number; the type of ticket sold—interpret the character and display either Child, Junior, or Adult; the quantity of tickets purchased; whether or not the customer had a discount coupon (display either YES or NO); the actual cost of the tickets—if the ticket is a Child ticket, then leave this entry blank, don’t display zeros; and the difference, if any, between the actual cost and what the user should have been charged.  (If the ticket is a Child ticket, leave the coupon and the actual charge columns blank:  there is no use displaying any of that for free tickets!)


The reason for the final column is that we have had some malfunctions in the ticket-selling equipment—at least, that’s what those minimum-wage ticket operators are saying—and we think that some tickets have been “underpriced”.  So, after you display the charged amount, the dollar value that came from the file, compute the actual amount that should have been charged.  Then, subtract the computed amount from the actual charge and display the difference.   (To remind you, adult tickets are $11.50 and junior tickets are $7.50 at full price.)


For example, suppose the ticket file has a sale for 6 Junior tickets and does not show any discount coupon.  That means the charged price for the tickets should have been $45.00.  But the file contains a charge of $33.75, a discounted price!  Someone’s selling tickets at a discount without approval!  The way this should look in the listing would be like line #4 in the listing below.  In the listing the fourth line shows we are short $11.25 for that particular ticket sale.


Display column headers at the top of the report so the table of ticket sales looks like, well, a table.  The listing should start out looking very similar to this for the actual file:


 #            TYPE                QTY         COUPON             ACTUAL CHG            DELTA

1            Adult                  2                NO                                          23.00                  0.00

2            Junior                 4                YES                                        22.50                  0.00

3            Child                  8

4            Junior                 6                NO                                          33.75              -11.25


 (NOTE:  dollar items in two decimal places and lined up right-justified.  And no entries for the Child tickets after the quantity column.)


Separate functions required.  There are two mandatory functions you must design and use in this program.  First, to display the type of ticket, like Adult or Junior, use a separate function to test the ticket type code and return the appropriate string to display:  do not do any output inside the function.  Main should be the only place that you print entries for the table on screen.  Second, use a separate function to compute the delta column:  calculate the true cost of the tickets; compute the difference between that and the actual charged value; and return the value to be displayed in the DELTA column.  These two functions are mandatory:  if you skip either one, your program will suffer a stiff point penalty.  The use of other functions is not mandatory, but highly encouraged.


When you’re finished processing individual sales records, clear the screen and display a polished final summary containing the following information:


Number of records included in the database (in the report, too, of course!)

Totals for each type of ticket:  for each type display the total number of tickets of that type and the total dollars received for that type.  (So, this means six separate totals, two for each ticket type.)

Total dollar sales overall.

Total dollar amount over or under the actual revenue.  (In other words the total of the delta column.)

Last, identify the ticket type that had the highest number of tickets sold and how many were sold.  Make this a separate “announcement” at the end of the report simply to highlight who is getting wettest in our new attraction!   For example:


“The largest ticket type sold was toddler tickets:  we sold a grand total of 79 toddler tickets.”


Note:  this is not the right answer for the data file you have, just an example of the output.  One other note:  be careful that you don’t make any changes to the data file, and then alter the code to reflect those changes.  Your instructor will be using an entirely separate data file whose format matches the file you have been given.  What that also means is that, if you “give up” on any part of the required logic and decide to just compute some answers and code those answers, that will be plain as day to your instructor!  In those circumstances, it would be better to simply skip that part of the output.


This C++ solution should be Program7 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, of course.




After your final summary, call another function to perform some additional analysis on the data file.  Reopen the file and calculate how much money we are “losing” with the coupon business.  For each ticket sold with the discounted coupon price, figure out the cost without the coupon and then the savings for each of those customers.  Add all of the savings values up to see how much revenue the coupon sale is costing us.  Display that total so the boss can see how much money was sacrificed to coupon sales and can possibly make a business decision:  we may need to curtail how often the coupons are printed or maybe reduce the value of a single coupon.  (I’m making this a separate file processing module so you don’t have to fold it into your original program.  Certainly, the best way to accomplish this task would be to do just that; but keep it separate for purposes of this extra credit.)  Make sure your flowchart includes this module.

"Get Help With Your Essay
. If you need assistance with writing your essay, our professional essay writing service is here to help!

Order Now