Question: Create a class Vehicle. A Vehicle has a single instance variable of type String named vehicleType that describes the vehicle. It has an abstract method
Create a class Vehicle. A Vehicle has a single instance variable of type String named "vehicleType" that describes the vehicle.
It has an abstract method getTires that takes no parameters and returns an ArrayList object that describes each Tire of the vehicle. A Tire class has been provided. Vehicle has a single constructor that takes the vehicle type as a parameter.
Create a class Bicycle that extends Vehicle that has two Tires, both of type "skinny". Bicycle should have a single default constructor.
Create a class Dragster that extends Vehicle and has four Tires, two of type "slick" and two of type "medium". Dragster should have a single default constructor.
Create a class Tricycle that extends Vehicle and has three Tires, all three "normal". Tricycle should have a single default constructor
tire.java is package optionB;
public class Tire
private String size;
public TireString size
this.size size;
public String getSize
return this.size;
@Override
public boolean equalsObject obj
if this obj
return true;
if obj null
return false;
if getClass obj.getClass
return false;
Tire other Tire obj;
if size null
if othersize null
return false;
else if size.equalsothersize
return false;
return true;
tester.java is
package optionB;
public class Tester
public static void mainString args
Vehicle bicycle new BicycleElectric;
System.out.printlnbicyclegetVehicleType;
forTire t : bicycle.getTires
System.out.printlntgetSize;
Vehicle dragster new DragsterTopFuel;
System.out.printlndragstergetVehicleType;
forTire t : dragster.getTires
System.out.printlntgetSize;
Vehicle tri new Tricycle Grammas Special";
System.out.printlntrigetVehicleType;
forTire t : tri.getTires
System.out.printlntgetSize;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
