CSD201_-_PE_-_SU_2024_-_Block_5_2621.webp
Minh Phúc2

CSD201_-_PE_-_SU_2024_-_Block_5_2621.webp

void addLast(String xOwner, int xColor, int xSize) - check if xOwner.charAt(0) == 'B' then do nothing, otherwise add new node with owner=xOwner, color=xColor, size=xSize to the end of the list. (color and size 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)
void f2() -There are 2 given Boat objects x, y in this function. Suppose the list contains at least 5 elements. Write statements to insert x and y to the list so that x will be the first (head), y will be the third element in the list. 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)(
(X,1,2) (C,9,8) (Υ,3,4) (D,6,3) (E,8,5) (F,5,4) (1,4,9)
1
void f3() - Suppose the list contains at least 4 elements. Remove the second node having color < 6 (thus if only one node having color < 6 then do nothing). Output in the file f3.txt must be the following:
C,8,6) (D,3,5) (E,9,2) (F,5,8) (G,9,7) (H,6,8) (1,7,3)((C,8,6) (D,3,5) (E,9,2) (G,9,7) (H,6,8) (1,7,3)
Close
+ 100%
Zoom
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Minh Phúc2
Ngày thêm
Lượt xem
7,137
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PE_-_SU_2024_-_Block_5_2621.webp
File size
90.9 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom