please need help with the java program
A micro car rental company.
package yourLastName.cis4110.assignment5;
Please create an enum type, say Cartype, featuring all rental car types -- SUBCOMPACT, COMPACT, MIDSIZE, FULLSIZE
(You may put the enum definition in Car class)
class Car
Instance variables:
- private String plateNum
- private Cartype carType
- private boolean availability
Member methods:
- Please define all setters and getters
class RentACar - This is a five car system for prototyping
instance variables:
- Car rentalCars[5] //a constant size so that you don't have to worry about handling the flexible size of the array.
member methods:
- public void setRentalCars(Car[] rentalcars) // array as a formal param
- public Car[] getRentalCars() //array as a return type; pay attention to deep copy
- public String rentACar(cartype) // eg. rentACar(Car.cartype.COMPACT);
return plateNum if available, otherwise null or empty string "" //search through the rental car list and find the first available car of the type matching the argument; //Please note, once the car is rented, the car's availability should be set to false or 0.
-returnACar(platNum) //Reset the car's availability to true
classManageCars// or any name if you'd like. Put your main() function here to test your program.
In your main()
1). You may manually create five Car objects here, say Car[] myRentalCars = new Car[5]. No need to use Scanner to ask user to input data to save time. e.g.: You may directly put - rentalCar[0] = new Car(); rentalCar[0].setPlateNum("P1"); rentalCar[0].setCarSize(Car.rentalcar.COMPACT); rentalCar[0].setAvailability(true); or using a Car constructor of three parameters e.g.: new Car("P1", Car.rentalcar.COMPACT,1);
2). Create a CarRental object, say myRental
3) myRental.setRentalCars(myRentalCars);
4) Put a few calls to rentACar() and returnACar() of myRental to test your program. e.g.: myRental.rentACar(Car.cartype.COMPACT); myRental.rentACar(Car.cartype.MIDSIZE); myRental.returnACar("PlateNo1");
To add any additional properties, methods if necessary