Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need an answer as soon as possible plz cuz i tried alot and came out with noth

ID: 3636407 • Letter: I

Question

i need an answer as soon as possible plz cuz i tried alot and came out with nothing and  i forgot the file in college and i need to send it online 4 hours from now for 3 marks so plz help me

" i will be rewriting the question to clear image"

Question 6:

Develop the following class Hierarchy:
1-Vehicle Class with the following members:
a-engine of type double(Engine Size)
b-price of type double (Price of the vehicle)
c-constructor to set the variables
d-getEngine() to return the engine size
e-toString() to return the information about the vehicle
2-Car class is -a vehicle with the following members;
a-model of type string(model of the car)
b-constructor to set the variables
c-calcTax() to return the tax on the car which is calculated according to the following  if the engine size is less than 1.6 the tax will be 40% of the price otherwise the tax will be 50% of the price
d=toString() to retuurn the information about Car in addition to tax and final price
3-Create two Car objects:
a-the first is 2.0,10000,Mazda
b-the second is created by getting its values from use

Explanation / Answer

class Vehicle { private double VIN number; private double make; private double model; private double price; private double miles per gallon; private double tank size; private double year; { public Vehicle1(double tempA, double tempB, double tempC, double tempD, double tempE, double tempF, double tempG) VIN number = tempA; make = tempB; model = tempC; price = tempD; miles per gallon = tempE; tank size = tempF; year = tempG; } { public Vehicle2(double tempH, double tempI, double tempJ, double tempK) VIN number = tempH; make = tempI; model = tempJ; year = tempK; } } class Vehicle 02 { 03 04 private double vinNumber; 05 private char make; 06 private char model; 07 private int year; 08 private double price; 09 private double milespergallon; 10 private double tanksize; 11 private double distance; 12 13 14 // take out here 15 16 public Vehicle(double vinNumber, char make, char model, int year, double price, 17 double milespergallon, double tanksize, double distance) 18 { // put it here 19 this.vinNumber = vinNumber; 20 this.make = make; 21 this.model = model; 22 this.year = year; 23 this.price = price; 24 this.milespergallon = milespergallon; 25 this.tanksize = tanksize; 26 this.distance = distance; 27 } 28 29 30 { 31 public Vehicle(double vinNumber, char make, char model, int year, 32 double milespergallon, double tanksize, double distance) 33 34 this.vinNumber = vinNumber; 35 this.make = make; 36 this.model = model; 37 this.year = year; 38 this.milespergallon = milespergallon; 39 this.tanksize = tanksize; 40 this.distance = distance; 41 42 } 43 } class Vehicle { String name; String chasisNumber; public void setName(String newName) { name = newName; } public String getName() { return name; } //..same way for chasis number } //Child class of super class vehicle class Car extends Vehicle { String engineCapacity; //2000litre 1000litre etc. public void setEngineCapacity(String newEngineCapacity) { engineCapacity = newEngineCapacity; } public String getnewEngineCapacity() { return engineCapacity; } //.. add other properties like max speed, manufacturer name etc. } public class Garage { public static void main(String[]args) { Vehicle v = new Car(); v.setName("Ferrari"); System.out.println(v.getName()); Car c = (Car)v; // explicit type casting needed. } } public class Car { private int yearModel; // The car's year model private String make; // The car's make private String speed; // The current speed Car(int year, String carMake, String newSpeed) { yearModel = year; make = carMake; speed = newSpeed; } public void setYearModel(int y) { yearModel = y; } public void setMake(String m) { make = m; } public void setSpeed(String s) { speed = s; } public int getYearModel() { return yearModel; } public String getMake() { return make; } public String getSpeed() { return speed; } public void accelerate() { speed += 5; } public void brake() { speed -= 5; } } public class carTest { public static void main(String[] args) { Car box = new Car( 1975, "Honda", "67"); Car box1 = new Car( 2004,"Toyota", "71"); Car box2 = new Car( 1989, "Ford", "100"); System.out.println(" yearModel Make Speed "); System.out.println("____________________… System.out.print(" " + box.getYearModel() + " " + box.getMake() + " " + box.getSpeed() + " "); System.out.print(" " + box1.getYearModel() + " " + box1.getMake() + " " + box1.getSpeed() + " "); System.out.print(" " + box2.getYearModel() + " " + box2.getMake() + " " + box2.getSpeed()); } } or public class Object { public Object() { // This space intentionally left blank. } public boolean equals(Object o) { return true; } protected void finalize() { // This space intentionally left blank. } public final native Class