next up previous
Next: Car sales: representation of Up: Unit 09 Previous: Static method for reading

Exercise: car sales

Specification:

We want to realize a program for handling new and used cars to sell. For each car to sell, the information about the car is stored on a text file.

Realize a class Car, to handle a single car. Each car is characterized by the following information: model, manufacturing year, driven kilometers, and price. New cars can be distinguished by the fact that the driven kilometers are 0.

The class Car should export the following methods:

Realize a class CarList, each of whose objects represents a list of cars to sell. A CarList object does not directly store the data about the cars to sell, but maintains the name of a text file in which such data are stored, according to the following format:

model
manufacturing year
driven kilometers
price

The class CarList should export the following methods:


next up previous
Next: Car sales: representation of Up: Unit 09 Previous: Static method for reading