Lab Assignment 5
CS201, Spring 2004


1. [Lab Manual] p159, 160, and 163. Everything. This exercise will not be graded.

2. Garage (5pt). This exercise is adopted from the Garage exercise from the lab manual, which uses an applet and class variables which we have not covered yet. Anyway, the problem description is as follows:  a parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any 24-hour perious is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program which take the number of hours (which could be a real number, e.g. 1.3) as input, and calculate and display the charges. Use GarageApp.java as your code template. Note that you must write a method calculateCharges to determine the charges.

3. Debugging (5pt). AverageSixApp.java, again adopted from the AverageSix applet from the lab manual, tries to calculate the lowest, hightest, and average of n student grades. The program should first ask a user for n, using showInputDialog, then asks the user for each grade, calculate the lowest, highest, and average, and display the results.

We are going to discuss the solutions on Monday, so please don't forget to bring your lab manual to the class.