Because toyotas are superior to fords or chevys it should


Use the supplied superclass Car to create the following classes. Ford, Chevy, Toyota.

Because Toyotas are superior to Fords or Chevys it should also implement the supplied Airplane interface. Give the methods something to do. I would suggest a println method since you can then see that the method actually ran.   

You will need to write a test class in order to check the behavior of your created classes. Instantiate objects of each one of your classes and invoke the methods of those objects.

The implementation for the getResaleValue method from the Car class will be different for Ford, Chevy and Toyota. Use the following formulas;

Ford

Resale value =$15,000 - depreciation .

Depreciation is calculated .06 per mile for first 75,000 miles and .10 per mile after 75,000

Chevy

Resale value =$15,000 - depreciation

Depreciation is calculated .055 per mile for first 70,000 miles and .095 per mile after 70,000

Toyota

Resale value =$15,000 - depreciation

Depreciation is calculated .035 per mile. If miles is greater than 200,000 add $10,000 to the resale value since car is now a classic.

---------------------------------------------------------------------------

Car superclass

public abstract class Car {

private int speed;

private String color;

private int miles;

public Car() {

speed = 0;

color = "red";

miles = 0;

}

public Car(int s, String c, int m ) {

speed = s;

color = c;

miles = m;

}

public int getSpeed() {

return speed;

}

public int getMiles() {

return miles;

}

public String getColor() {

return color;

}

public abstract boolean equals(Object o);

public abstract double getResaleValue();

public String toString() {

return getClass().getName() + "[speed = "+getSpeed()+" color = "+

getColor()+"]";

}

}

 

Airplane Interface

public interface Airplane {

public abstract void takeoff();

public abstract void fly();

public abstract void land();

}

 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Because toyotas are superior to fords or chevys it should
Reference No:- TGS0646985

Expected delivery within 24 Hours