1 Test yourself by writing the answers out by hand - pen Your name: Full-time study Part-time study (delete one) All questions are long answer questions. When writing code to solve a given problem or code a data structure, you must also provide a test-plan, a test program and unit tests for data structures or classes. 1. Write a program that prompts the user to input the elapsed time for an event in hours, minutes, and seconds. The program then outputs the elapsed time in seconds. What test data would you use to make sure that your program works. You need to provide reasons for selecting the test data. 2. The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets with each type having its own price. After each game, data is stored in a data file called sales.txt . The data file format is as shown below: Ticket price numberOfTicketsSold ..... Sample data is shown below. You must not assume that this will be the data after every game. There is only data and no column headers. Data items on the same line are separated by white space. 250 5750 100 28000 50 3570 25 18750 The first line indicates that the ticket price is $250 and that 5750 tickets were sold at that price. Your program outputs the number of tickets sold and the total sale amount.
You've reached the end of your free preview.
Want to read all 3 pages?
- Summer '17
- Data Structures