Question: With java a) Create a class named Motorcycle. Define 3 private variables in this class. These variables show the mark, speed and price features of

 With java a) Create a class named Motorcycle. Define 3 private

With java

a) Create a class named Motorcycle. Define 3 private variables in this class. These variables show the mark, speed and price features of the motorcycle. Create a 3-parameter constructor to assign values to the instance variables during object creation. b) Construct ...get... ( ) and ...set...(...) methods for each instance variable in the Motorcycle class. c) Produce a subclass named Yamaha, which derives from the Motorcycle class. In this class, define a private variable that indicates the age of Yamaha; create a 4-parameter constructor for the object to be created on Yamaha and ensure that it assigns values to all variables of the subclass and superclass. d) In the Yamaha class, create the ...getPrice( ) method, which reduces the price at a certain rate according to the speed and age of the Yamaha. In this method, if Yamaha's speed is up to 190km/h and its age is between 3 and 5 years, a 20% discount is made on the price, and no discount is made for any other situation. Provide the passing the renewed price value to the price variable in the superclass. To do these operations, use of the necessary methods of the superclass. Also, create the get...( ) and set...(...) methods for the age variable in the Yamaha class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!