CS 230 Fall 2004                                            Assignment 8 – Developing and using test cases for a program                            50 points

Assigned: 10/27/2004

Due: 11/02/2004 at the start of class

 

IT IS NOT APPROPRIATE TO GET ANSWERS FROM CLASSMATES ON THIS ASSIGNMENT!! WORK INDIVIDUALLY !!!!!

 

Pre-Lab (Do Before Lab):  None – Attend start of lab on 10/27 – when testing strategy will be discussed!

 

Main Assignment:

There is a buggy version of a program, named speedingWrong, available in the assignments page of my WWW site (Look under Assignments at www.lasalle.edu/~redmond/teach/230 ). Save it to disk and if I ended up zipping it to put it on the WWW, unzip it. The program is described below. However, this version has bugs. Your mission is to test it, so you can notify the developer which test cases provide incorrect results. The skills learned here can also be useful for testing your own programs.

 

What I want from you is (either hand in via paper or e-mail to redmond@lasalle.edu  is fine):

 

1)     The answer to: How many test cases (runs through the program) are necessary to thoroughly test the program? EXPLAIN YOUR ANSWER!!! 

2)     Tell me what runs you did. Indicate which test cases gave correct results and which exposed flaws in the program. Using table form would be helpful! Vague or broad descriptions are not sufficient.

 

You DO NOT have to determine what the problem(s) are or how to fix them. The focus of this assignment is on catching bugs. My plan is to only provide you the executable; if I’m able to do that, you will not be able to fix at all.

 

Ok, here's the application description:

 

The NJ State Police are working on a new program in conjunction with the EZ Pass system. This program is a simplification. It should allow the user to process a number of cars in a batch (“event driven loop”). For each car, the program should get from the user for the time spent, miles traveled and the speed limit on the stretch of the Garden State Parkway traveled - (in real life these would be obtained via the scanning process)). The program should calculate and display the speed and calculate and display any fine owed (see details below). The program should update summary information including how many cars were speeding, the percent of cars speeding, average speed, the total fines charged, and fine averages.

 

Details:

1.      The schedule for fines is as follows:

·        On or under speed limit - no fine

·        less than or equal to 5 mph over the limit - $20 fine

·        more than 5 mph and less than or equal to 10 mph over the speed limit -

-        fine is $20 plus $2 for each mph over the speed limit.

·        more than 10 mph and less than or equal to 20 mph over the speed limit -

-        fine is $20 plus $4 for each mph over the speed limit.

·        more than 20 mph over the speed limit -

-        fine is $50 plus $5 for each mph over the speed limit.

2.      If the speed limit on the stretch of highway is 65 or higher, then the above fines are DOUBLED.

3.      The program should ensure that the user types in valid data (i.e. numeric data; positive number of miles and minutes, speed limit no lower than 35, and no higher than 70).  

4.      Hopefully the summary information is self-explanatory. Any questions about what they are, please ask!!

 

Note that everything above was taken from a description of a task for a previous class. It is not your task. Your task is to use test cases to gather evidence about problem(s)!! The skills learned here can also be useful for testing and debugging your own programs.