|
I cant seem to compile the code, if you can help please reply! The code is
/** A CarDealer object represents a business that buys and resells used cars */ import java.util.ArrayList; import java.util.HashMap; public class CarDealer { private int dayNumber; // Day number from start of operation of business // HashMap objects are used to provided easy lookup of cars using their registrations // Each HashMap entry comprises a car registration as key, and the corresponding Car object private HashMap<String, Car> prepStock; // To hold cars being prepared for sale private HashMap<String, Car> saleStock; // To hold cars on sale private int[] sales; // An ArrayList field is needed, to hold the Sale objects created as sales are made
/** Constructor */ public CarDealer() { dayNumber = 1; prepStock = new HashMap<String, Car>(); saleStock = new HashMap<String, Car>(); sales = new int[100];// to hold sales
} public void advanceDate() { dayNumber++; System.out.println("Day is now: " + dayNumber); } /** Note: Methods addCar, putOnSale, reducePrice and sellCar should print a confirmation * message, or an error report if the operation cannot sensibly be performed. */ /** Method to be called when the dealer has acquired a car. * A Car object representing the car is added to the preparation stock. */ public void addCar(String reg, String model, int paid) { System.out.println("addCar"); System.out.println("putOnSale"); System.out.println("reducePrice"); System.out.println("sellCar"); { } prepStock.add(new Car(reg, model, paid));
}
|