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.
2 Respostas
+ 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.
0
Please provide your attempt.
https://www.sololearn.com/discuss/333866/?ref=app