Package crms.lib
Class RentalReport
java.lang.Object
crms.lib.RentalReport
Represents a report for a rental, including information about the rental
duration and its current status (active or inactive).
This class is immutable and contains methods for formatting the rental period and determining the rental status.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum representing the rental status. -
Constructor Summary
ConstructorDescriptionRentalReport
(Rental rental) Constructs a RentalReport with the specified rental. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.Returns the formatted duration of the rental.Returns the rental associated with this report.Returns the current status of the rental.int
hashCode()
Returns a hash code value for the object.
-
Constructor Details
-
RentalReport
Constructs a RentalReport with the specified rental. The duration is calculated based on the rental period, and the status is determined based on the current date and the rental's end date.- Parameters:
rental
- the rental for which the report is generated
-
-
Method Details
-
getRental
-
getDuration
Returns the formatted duration of the rental.- Returns:
- the rental duration as a formatted string
-
getStatus
Returns the current status of the rental.- Returns:
- the rental status
-
equals
Indicates whether some other object is "equal to" this one. Two RentalReports are considered equal if they have the same rental ID. -
hashCode
-