Question: Using the inheritance concept, develop a Java application for a company to help them on their bicycle rental business operation. (a) Define a class named
Using the inheritance concept, develop a Java application for a company to help them on their bicycle rental business operation.
(a) Define a class named BicycleRent which consists of protected fields that hold a customer name, customer ID, bicycle type, and length of rental in days. This class contains all the setter methods for each of the objects attributes. Provide a method calculateRental() to calculate and return the total rental bill, which will be calculated based on the bicycle type: one-seater at RM30 per day, two-seater at RM60 per day, and three-seater at RM80 per day. This class includes a display() method that displays all the rental data.
(10 marks)
(b) Create a subclass for BicyleRent named InsuredBicycleRent. This class sets the rental fee with addition RM20 per day and prompts the user to respond to the option of including a padlock at RM5 per day. Override the superclass calculateRental() method to include the insurance and padlock fees charged. Write another application named TestBicycle that prompts the user for the data needed for an object of BicycleRent and another object InsuredBicycleRent. Display the total rental bills for both objects. (15 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
