Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions