Question: Question 2 Write a MotorCycle class with the following attributes: ( efficiency ) measured in miles / gallon ( double ) ( tank ) capacity

Question 2
Write a MotorCycle class with the following attributes:
(efficiency) measured in miles/gallon (double)
(tank) capacity measured in gallons (double)
Your class should include the following methods:
setEfficiency: sets the efficiency of the cycle
getEfficiency: gets the efficiency of the cycle
setTank: sets the amount of gas in the cycle
gettank: gets the amount of gas in the cycle
Launch External Tool
addGas: this method adds gas to the tank
drive: this method simulates driving the cycle for a certain distance (in miles), reducing the fuel level in the gas tank. Hint: MPG
Your class should not include a constructor and MUST use the default constructor.
To test your class you will need to instantiate a MotorCycle object myCycle in the MotorCycleDemo class.
You are required to implement the class according to the requirements specified in the comments displayed in CodeCheck.
Launch External Tool
 Question 2 Write a MotorCycle class with the following attributes: (efficiency)

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!