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
Related Q & A:
- Is Java fully object-oriented?Best solution by Stack Overflow
- What are the object-oriented features of Visual Basic.NET?Best solution by msdn.microsoft.com
- How to write a program to monitor the temperature of CPU?Best solution by Stack Overflow
- How to Convert a Procedural Programming into Object-Oriented Programming?Best solution by Stack Overflow
- How to write a TV program proposal?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.