For this assignment we will define an interface for items that can be rented. And then define a pair of classes that implement that interface.
Create a new Java project called “Rentable”. Inside the project, create five classes:
Rentable
the requires the following methods
getDescription();
returns the description of the item (return type String
)getDailyRate();
returns the daily rate for renting the item (return type double
or Double
)getPrice(double days);
returns the amount due for renting the item for the a given number of days (return type double
or Double
)Define a Room
class that implements the interface and has a dailyRate
variable of type double
or Double
.
Define a Condo
class the implements the interface and has a weeklyRate
variable of type double
or Double
.
Define a Tool
class the implements the interface and has an hourlyRate
variable of type double
or Double
.
RentableProgram
class that will contain your main method and act as a “driver” for your program. Your main
method should:
Room
, Condo
, Tool
), and add them to an array of Rentable
objects.