void addLast(String xProducer, int xWeight, int xPrice). Note: xWeight and xPrice must be bigger than 0.
void f1() - Do not edit this method. Your task is to complete the addLast(...) method above only.Output in the file f1.txt must be the following:
(H,6,7) (C,4,5) (1,5,8)
void f2()-There are 2 given Laptop objects v, w in this function. Suppose the list contains at least 3 elements. Write statements to insert v and w to the list so that w will be the 2nd, v will be the 3rd node. Output in the file f2.txt must be the following:
(D,4,7) (E,9,2) (Q,7,6)
(D,4,7) (W,1,7) (V,8,9) (E,9,2) (Q,7,6))
1
void f3()- Delete the node holding the heaviest Laptop (maximum weight). If there are more than one node satisfying the requirement, delete the last of them. Output in the file f3.txt must be the following:
(B,9,2) (D,2,6) (E,9,4) (Q,4,5) (R,3,7)
(B,9,2) (D,2,6) (Q,4,5) (R,3,7)
void f4() - How many Laptops are in the list? The output in the f4.txt file should be as follows:(H,1,3) (1,3,7) (J,4,5) (K,5,6) (L,6,8)
5
+ 90%
Zoom
Close