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

  Create scenario making purchase or develop use case diagram

You are developing the requirements for an online shopping system. To place an order, a user connects to the system, searches to find items to purchase, selects one or more items, and supplies credit card information to pay for them.

  Networks present of opportunities for security challenges

1. Networks present a lot of opportunities for security challenges. What type of network are you on, and what security elements are employed? Are they effective? Why or why not?

  Name the obligatory select query clauses in the correct orde

Name the obligatory SELECT query clauses in the correct order

  A deck of playing cards in a card game

A deck of playing cards in a card game where cards may be drawn from, or discarded to, either the top or the bottom of the deck, but no access to cards in the middle of the deck is permitted.

  You are a bank manager and you are helping

You are a bank manager and you are helping a new bank teller understand the kind of accounts the bank offers. If a customer comes in asking to open a new savings account, the teller needs to ask what kind of account-passbook savings or certificate..

  Find final contents of cache using direct-mapped cache

Suppose direct-mapped cache with 16 one-word blocks that is initially empty, label each reference in list as hit or miss and find final contents of the cache.

  Create method return the number of positive numbers in array

Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} a. Complete the method named count(int[] a) in the class Count.

  What would programs have to do for each type of hardware

If an applications' requests for data did not go through the OS, what would programs have to do for each type of hardware?

  What are the pros and cons of each raid

Please explain how each RAID configuration works and what are the pros and cons of each RAID?

  Explain why its difficult to support direct assess to files

explain why its difficult to support direct assess to files with variable length records. suggest a method for handling this type of file if direct access is required.

  Explain file containing sporting goods which are sold online

You have file containing sporting goods which are sold online. Each item record contains item id, item name, item description, item category, item price, and units in stock.

  Picking a location for a network operation center noc

What are the three key factors that you would consider in picking a location for a Network Operation Center? (NOC)?

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