Question: In java 2. In package rentalcar, write a Java class named RentalCar. Every RentalCar instance has a vin (String), and a CarMake, and a year

 In java 2. In package rentalcar, write a Java class named

In java

2. In package rentalcar, write a Java class named RentalCar. Every RentalCar instance has a vin (String), and a CarMake, and a year (int). 3. Create in package rentalcar, an enum type, CarMake with these declared values: TOYOTA, NISSAN, CHEVY, HONDA, CHRYSLER, TESLA 4. In your RentalCar class a) Declare a public constant DEFAULT_VIN and assign it to be "0000" Declare a public int constant named MAX_YEAR and assign it to be 2021. Declare a public int constant named MIN_YEAR and assign it to be 2015. b) Declare private attributes for the RentalCar class as described above. c) Write a default (no argument) constructor for the RentalCar class places DEFAULT_VIN, TOYOTA, and MAX YEAR in the instance. d) Write a second constructor for the RentalCar class that receives a vin, a year, and a carmake. Validate the vin (4 chars in length, only letters and digits allowed, ALWAYS STORED IN UPPERCASE, if invalid use DEFAULT_VIN. Validate the year - MIN_YEAR to MAX_YEAR inclusive, use MAX_YEAR if invalid. e) Write a getters, getVin().getMake(), and getYear() and setters setVin(String a Vin), setMake(CarMake a Make), setYear(int a Year) (all setters are void), write a toString() as expected nicely formatted with proper spacing and NO NEWLINES in the string returned from toString()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!