How to create an Object with multiple properties of the same name?

Write a Java program according to given requirements using object oriented concepts in java.?

  • Write a Java program according to given requirements using object oriented concepts in java. Create a super class called Car. The Car class has the following fields and methods. · int speed; · double regularPrice; · String color; · double getSalePrice(); Create a sub class of Car class and name it as Truck. The Truck class has the following fields and methods. · int weight; · double getSalePrice(); //If weight>2000, 10% discount. Otherwise, 20% discount. Create a subclass of Car class and name it as Ford. The Ford class has the following fields and methods · int year; · int manufacturerDiscount; · double getSalePrice(); //From the sale price computed from Car class, subtract the manufacturerDiscount. Create a subclass of Car class and name it as Sedan. The Sedan class has the following fields and methods. · int length; · double getSalePrice(); //If length>20 feet, 5% discount, Otherwise, 10% discount. Create MyAutoShop class which contains the main() method. Perform the following within the main() method. · Create an instance of Sedan class and initialize all the fields with appropriate values. Use super(...) method in the constructor for initializing the fields of the superclass. · Create two instances of the Ford class and initialize all the fields with appropriate values. Use super(...) method in the constructor for initializing the fields of the super class. · Create an instance of Car class and initialize all the fields with appropriate values. Display the sale prices of all instances.

  • Answer:

    Please don't come here expecting somebody to do your computer science homework for you, kid. Do your own work.

Supun at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.