CSCE 2004 - Homework 4
Due Date - 10/05/2012 at 11:59 PM

1. Problem Statement:

The objective of this programming assignment is to become familiar with using C++ functions for problem decomposition. You will write a main program that calls functions that are already written and provided to you. Here is a link to the code that you will modify: hw4.cpp

The goal of the program is to simulate ticket sales at a sporting event. The ticket office offers four types of tickets, which are Nosebleed, Box Seats, Fifty Yard Line and Student Section. The customer can purchase tickets by cash or by a credit card. In either case, the customer should enter the type of ticket he/she wants to buy as well as the number of tickets. The customer should be able to cancel the purchasing process before the payment processing starts. If the customer pays in cash, he/she should get change back (if any). If the customer prefers to buy using a credit card, he/she should receive a message that his/her card will be billed.

2. Design:

Read the program hw4.cpp and think about how you can use the provided functions in your main() function, how the parameters need to be passed to the functions, the type of parameters that are being used and how you can use the return values.

A skeleton of the main program is included with comments showing the necessary steps where work needs to be provided. The necessary variables for your program are already declared, therefore all you need to do is use them in your work. Do not change the functions themselves! You just need to create a main program that uses them. If you feel you need extra variables in the main program, you may add them, but they should not be necessary.

3. Implementation:

The first thing your program should do is echo your name and UAID to the screen so that your executable, when run, tells us who wrote the program. You should also include your name and UAID in the comments at the top of the program.

The second thing your program should do is to let a user choose his/her payment type (cash or credit). Then, there should be a menu asking the customer what ticket type he/she wants to purchase. Then, depending on the choice, the program calls the appropriate function to do some calculations. At the end, the customer should get a bill of his/her purchase as well as a change back if any in case of cash payment. If the type of payment is cash, the customer should get the change back in dollars, quarters, dimes, nickels and pennies.

Start your program with comments based on your design and add portions of code a little at a time. Compile and run your program on a regular basis, so you always have something that runs, even if it only does part of the job. Make sure you have completed the first task, e.g., printing your name to the screen, before you start writing code for the second task. Remember to add comments to your program to explain your program. Do this before/during programming instead of waiting until the end.

4. Testing:

Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program on 2-3 input documents, and save your testing output in text files for submission on the program due date.

5. Documentation:

When you have completed your C++ program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate text file to be submitted electronically.

6. Project Submission:

In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "upload" your documentation and testing document (pdf, doc, or txt file), and your C++ program (cpp or txt file).

The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit:

You will receive partial credit for all programs that compile even if they do not meet all program requirements, so handing projects in on time is highly recommended.