0

Create a super class called Car

A. Create a super class called Car. The Car class has the following fields and methods. • int speed; • double regularPrice; • String color; • getSalePrice() method which is just increase the regular price to 10%; B.Create a sub class of Car class and name it as Truck. The Truck class has the following fields and methods. • intweight; • double getSalePrice(); // Ifweight>2000,10%discount. Otherwise, 20%discount C. Create a Main class Create an instance of Truck class and initialize all the fields with appropriate values. Use super(...) method in the constructor for initializing the fields of the superclass. Display the sale prices of Truck instance.

12th Apr 2021, 2:02 AM
Onin Abellanosa
Onin Abellanosa - avatar
2 Answers
+ 1
here's the solution boi: https://code.sololearn.com/cF7Umh1Y09wv/?ref=app next time, provide an attempt. also, your question is now my property.
12th Apr 2021, 2:35 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
12th Apr 2021, 2:14 AM
你知道規則,我也是
你知道規則,我也是 - avatar