☑Kizspy.me
You should write the statements to complete the Suitcase class as described below:
-id: int
- name: str
-capacity: float
maxWeight: int
Suitcase
+ Suitcase(id:int, name:str, capacity: float,
maxWeight:int)
+ expand_suitcase ():float
+ toString(): void
Where:
• Suitcase(id:int,
•
name:str, capacity:float,
maxWeight:int) - parameterized constructor
that sets values for id, name, capacity, and
maxWeight.
expand_suitcase(): float - This method increases
the suitcase's capacity based on its maxWeight
and returns the expanded capacity:
"
If maxWeight
capacity.
15, it adds 5 to the
■ If 7 < maxWeight <15, it adds 2 to the
"
capacity.
If maxWeight <= 7, the capacity remains
the same.
.toString(): void-print out the information of the
Suitcase: id, name, capacity, maxWeight, and the
remaining capacity. Format the capacity in two
decimal places.
Notes:
-You can create new function(s) if you see it is necessary.
-Do not edit given statements in the main function.
Sample input and output:
Zoom
+ 100%
Close