Lab #5: Renting Corvettes

In this lab, modify the Car Rental Agency simulation (from the Goldberg & Robson handout) to rent more than Cars and Trucks. Rent Corvettes, Mini-Vans, Subcompacts, and Pickups. The probability distributions and numbers of each are up to you. You will also need the simulation package.

SUGGESTION: Don't create four different "Renter" classes, as the handout does it. (Without use class variables!) Instead, create one Renter who decides at task time what kind of vehicle to rent. (See the handout on the Traffic simulation, or visit STABLE's generic step on random numbers to figure out how to make that decision at Tasks-time.) (Yes, this is just a suggestion. You can take the easy but longer way out if you want.)

To run the simulation provided, use the code below:

        | aSimulation aFile |
        aFile := (Filename named: 'rental.events') writeStream.
        CarRenter  file: aFile.
        TruckRenter file: aFile.
        aSimulation := RentalAgency  new startUp.
        [aSimulation time < 250] whileTrue: [aSimulation proceed].
        aFile close

Mail your working simulation to cs2390@prism.