Zoom
Kizspy. me a. f1(): 2.5 marks - Load data
- FUO
To complete the requirement f1(), students need to:
1. Implement the function addLast(String name, int weight, int length, int fragile) in the
ItemList class-list
2. Implement the function push(String name, int weight, int length, int fragile) in the Truck
class - truck
The expected output used to test your code are as follows:
ItemList Inventory: (Stove, 10, 2, 0) (Lamp, 5, 1, 1) (Table, 80, 3, 0) (Sofa, 50, 2, 0) (TV, 20, 1, 1)
(Chair, 7, 1, 0)
Truck Contents: (Pot, 10, 1, 1) (Bed, 100, 2, 0)
b. f2(): 2.5 marks - Load the first fragile item onto the truck
To complete the requirement f2(), students need to:
1. Implement the deleteFirstFragile() function to remove the first fragile item from the list.
2. Then push this item into the truck.
The expected output used to test your code are as follows:
ItemList Inventory: (Stove, 10, 2, 0) (Lamp, 5, 1, 1) (Table, 80, 3, 0) (Sofa, 50, 2, 0) (TV, 20, 1, 1)
(Chair, 7, 1, 0)
Truck Contents: (Pot, 10, 1, 1) (Bed, 100, 2, 0)
ItemList Inventory: (Stove, 10, 2, 0) (Table, 80, 3, 0) (Sofa, 50, 2, 0) (TV, 20, 1, 1) (Chair, 7, 1, 0)
Truck Contents: (Lamp, 5, 1, 1) (Pot, 10, 1, 1) (Bed, 100, 2,0)
c. f3(): 2.5 marks - Load all fragile items onto the truck
To complete the requirement f3(), students need to:
1. Remove all fragile items from the list.
2. Then push each removed item into the truck in the same order as they removed in the
+100%
Close