Use the supplied superclass car to create classes

Assignment Help Basic Computer Science
Reference no: EM13308299

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();

}

 

Reference no: EM13308299

Questions Cloud

What software must be considered to provide adequate : Based on the Vosevich (2012) article, what software must be considered to provide adequate security and risk management across the enterprise?
Potential conflicts that could naturally occur : Most people have a blend of leadership styles they use. Some leaders are more flexible in applying a wide range of leadership styles while others are more consistent and generally use just one or two preferred behaviors. If two strong individuals beg..
At most how high can the probability of a major security : At most how high can the probability of a major security breach be with the IDS in place for a risk-neutral rational decision maker to purchase the IDS?
How far does a horizontal plane depart from a level surface : The width of a lake is 16 km (it is a flat plane tangent to the radius of the sphere). How far does a horizontal plane depart from a level surface if the earth is a sphere with r=6371km
Use the supplied superclass car to create classes : 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.
Prove that h is a normal subgroup : Prove that H is a normal subgroup of G and compute the order of the factor group G=H.
Determine approximately what the ratio of the density of air : Consider an air bubble rising from the bottom of a lake. Neglecting surface tension, determine approximately what the ratio of the density of the air in the bubble will be at a depth of 34ft to its density at a depth of 8 ft
Translate the first instruction into english : Suppose the memory cells at addresses 00 through 03 in the machine described in Appendix C contain the following bit patterns.
How long does it take you to get to the other side : You are in a kayak which can move at a velocity of 2.6 m/s when in still water. You are attempting to cross a river which is 110 across, How long does it take you to get to the other side

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd