CS 157 Spring 2001                          Assignment 5 – Developing and using test cases for a program                               50 points

 

Assigned: 02/15/2001

Due: 02/21/2001 at the start of class

 

Pre-Lab (Do Before Lab): None

 

Main Assignment:

                There is a buggy version of a program, named cs157a5wrong.c, available in the assignments page of my WWW site (Look under Assignments at www.lasalle.edu/~redmond/teach/157 ). Use Internet Explorer - we had trouble with Netscape, and save it do your disk – make sure there is no html in the file. 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.

 

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.

 

Ok, here's the application description:

 

The University of Northeast Philadelphia has a new tuition scheme and wants a program that prints tuition owed by a student registering by the phone registration system.

 

In UNEP's new tuition scheme, both in town and out of town students would get a 20% discount for living in the dorms or for committing to use public transportation to get to school. In addition, tuition would be charged according to the following schedule:

 

   Undiscounted, per credit costs

 

                             In Town       Out of Town

   First 12 credits           500            1000

   Next 9 credits             200             400

 

For instance, an in-town, nondiscounted student taking 15 hours would pay:

                                (12 * 500) + (3 * 200) = 6600

 

The program gets as input an indicator (I or O) of in-town or out of town, an indicator (D or N) of dorm/ public transit discount or none, and the number of credits registered for. Each of these pieces of information is validated (number of credits must be at least 1 credit and no more than 21 credits).