Expected result:
NEWNODE, 7-Up, Carton of 24 cans, 320ml, 169.000 PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000
MD033, Mirinda, Carton of 24 cans, 320ml, 168.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000 2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
b. f2(): Write your code to insert a new_node (given in the file) after the fourth node (which index is 3) of the current list.
Expected result:
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000 MD033, Mirinda, Carton of 24 cans, 320ml, 168.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000 2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
NEWNODE, Sprite, Carton of 24 bottles, 390ml, 112.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
c. f3(): Find the last node in the linked list that has Drink's price higher than 200.0, if such a node is found, then set the price of Drink in this node to 999.0
Expected result:
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000
MD033, Mirinda, Carton of 24 cans, 320ml, 168.000 SP005, Schweppes, Carton of 24 cans, 320ml, 220.000
2C017, Coca-Cola, Carton of 24 bottles, 600ml, 999.000
MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
d. f4(): Remove the second node, then sort the linked list in an descending order according to Drink's price.
Expected result:
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000
2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000 MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
e.f5(): Delete the first node in the linked list with Drink's unit = 'Carton of 24 cans'.
Expected result:
PS021, Pepsi, Carton of 24 bottles, 390ml, 175.000
SP005, Schweppes, Carton of 24 cans, 320ml, 220.000
2C017, Coca-Cola, Carton of 24 bottles, 600ml, 218.000 MD020, Mirinda, Carton of 24 bottles, 390ml, 175.000
+ 100%
Notes:
Close