Question: Question 1 (20 points] Implement the class Vehicle only. The code of the classes Bicycle and Car is provided below. Vehicle #brand: String # model:

 Question 1 (20 points] Implement the class Vehicle only. The codeof the classes Bicycle and Car is provided below. Vehicle #brand: String# model: String # price: double #checkIn: ArrayList + Vehicle () +

Question 1 (20 points] Implement the class Vehicle only. The code of the classes Bicycle and Car is provided below. Vehicle #brand: String # model: String # price: double #checkIn: ArrayList + Vehicle () + Vehicle ---All parameters ---) + addCheckInLocation (p: String) + removeCheckInLocation (p: String) + toString(: String + Bicycle --All parameters---) +toString(): String Bicycle (Do not implement this class) - gearCount :int Car - fuelType : String +Car ---All parameters----) + toString():String A. The Vehicle class is characterized by four data fields: a String brand, a String model, a double price and an array list of strings checkin. Write the following methods:|| a) Two constructors (as shown in the UML). a) w cousu CIUS (43 SHU WILL I CIVIL). b) Getters and setters (only for the attributes brand and price). c) addCheckInLocation method that takes as parameter the name of a location to be added to the array list. If this name already exist in the list the message EXIST must be displayed. d) removeCheckInLocation method that takes as parameter the name of the location to be deleted from the array list. e) A toString method to return information about all data fields. Page 4 of 5 B. The Bicycle class inherits from the class Vehicle. The code is below: import java.util.ArrayList; public class Bicycle extends Vehicle { private int gearCount; public Bicycle (int gearCount, String brand, String model, double price, ArrayList checkin) { super (brand, model, price, checkIn); this.gearCount = gearCount; } public String toString() { return super.toString() + ", the gear count is + gearCount; } } T! C. The Car class inherits from the class Vehicle. The code is below: import java.util.ArrayList; public class Car extends Vehicle { private String fuelType; public class Car extends Vehicle { private String fuelType; public Car (String fuelType, String brand, String model, double price, ArrayList checkin) { super (brand, model, price, checkIn); this. fuelType = fuelType; } public String toString() { return super.toString() + ", the fuel type is + Fuel Type; } }

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!