void addLast(String xMaker, int xVolume, int xColor) - check if xMaker.charAt(0) == 'B' then do nothing, otherwise add new node with maker=xMaker, volume=xVolume, color=xColor to the end of the list. (volume and color can get arbitrary, even negative values).
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:
(A,9,8) (C,6,5) (D,2,4) (E,7,9) (F,4,-7) (G,-3,2)
void f2() -There are 3 given Bottle objects x, y, z in this function. Suppose the list contains at least 3 elements. Write statements to insert x, y and z to the list so that x, y, z will be at positions 0, 2 and 3 (The head's position is 0). Output in the file f2.txt must be the following:
(C,9,8) (D,6,3) (E,8,5) (F,5,4) (1,4,9) (1,3,7)
(Χ,1,2) (C,9,8) (1,2,3) (2,3,4) (D,6,3) (E,8,5) (F,5,4) (1,4,9) (1,3,7)
1
void f3() - Suppose the list contains at least 3 elements. Remove the first node having maximum volume and insert it at position 2. (The head's position is 0). Output in the file f3.txt must be the following:
(C,7,6) (D,6,7) (E,3,8) (F,7,9) (G,8,7) (H,4,9) (1,8,3)
(C,7,6) (D,6,7) (G,8,7) (E,3,8) (F,7,9) (H,4,9) (1,8,3)
Cunnece the list centaine at least Calomonte and a is the Cth alament in the list Channe
+ 100%
Zoom
Close