Classes you must create: Define a Vehicle class. It should have attributes for make, model, color, current
Question:
Classes you must create: Define a Vehicle class. It should have attributes for make, model, color, current mileage, original cost, and a boolean that keeps track of whether the vehicle is currently rented. It should have getters/setters for each attribute. It must have a constructor to set all attributes. It should have an override for toString or ToString which returns a string similar to: Available: Blue Nissan Versa with 105 miles Rented: Blue Nissan Versa with 105 miles Define an Economy_Car class. It should inherit from Vehicle. It should have an attribute daily_rental_rate. Make a constructor which takes in make, model, color, current mileage, original cost, and daily rental rate. Make an override for toString/ToString which prints: Economy Car: Rented: Blue Nissan Versa with 105 miles Note most of this is just the text that your parent class prints. Define a Midsize_Car class. It should inherit from Vehicle. It should have an attribute daily_rental_rate. Make a constructor which takes in make, model, color, current mileage, original cost, and daily rental rate. Make an override for toString/ToString which prints: Midsized Car: Available: Green Dodge Avenger with 15720 miles Note: Most of this is just the text that your parent class prints. Define a SUV class. It should inherit from Vehicle. It should have an attribute daily_rental_rate. Make a constructor which takes in make, model, color, current mileage, original cost, and daily rental rate. Make an override for toString/ToString which prints: SUV: Available: Silver Toyota RAV4 with 432 miles Note: Most of this is just the text that your parent class prints. Driver Program: In your driver class, Make an ArrayList/List of Vehicles. Add each of the vehicles in the table above to your ArrayList/List. Make a method show_cars which takes in the ArrayList/List and prints out all of the vehicles in a menu like this: 0. Return 1. Economy Car: Available: Blue Nissan Versa with 105 miles 2. Economy Car: Available: White Toyota Yaris with 8422 miles 3. Midsized Car: Available: Green Dodge Avenger with 15720 miles 4. Midsized Car: Available: Yellow Ford Focus with 2368 miles 5. SUV: Available: Silver Toyota RAV4 with 432 miles Make a method rent_cars Using a loop, prompt the user to: "Choose a car to rent:". Call the show_cars() method above to produce a menu. Read in a response, so long as it's not 0, mark the chosen car as rented. Make a method return_cars Using a loop, prompt the user to: "Choose a car to rent:". Call the show_cars() method above to produce a menu. Read in a response, so long as it's not 0, mark the chosen car as available. Produce a main menu that looks like this: 1. Rent cars 2. Return cars 3. Quit Read in a choice and call the appropriate method above as long as the user doesn't choose 3.
Practical Introduction To Data Structures And Algorithm Analysis Java Edition
ISBN: 9780136609117
1st Edition
Authors: Clifford A. Shaffer