CSD201_Fall-2023_HCM_Ca_2_1980.webp
Thanh Loan1

CSD201_Fall-2023_HCM_Ca_2_1980.webp

do not edit them. The MyList class is a linked list of Plane objects. The following methods should be completed:
void addLast(String xType, int xCapacity, int xPrice)- Check if xPrice<1000 then do nothing, otherwise add new node with type=xType, capacity=xCapacity, price=xPrice to the end of the list.
void f1() - This method is used to test the addLast method above. You do not need to edit this function. Output in the file f1.txt must be the following:
Content of the file f1.txt:
(A,9,1500) (Β,5,3000) (C,6,5000) (E,7,9000) (F,4,7000)

void f2()- There are 2 given Plane objects x, y in this function. Suppose the list contains at least 3 elements, write statements to insert x and y to the list so that y will be the second,x will be the last node. Output in the file f2.txt must be the following:
FUOVERFLOWICOM
Content of the file f2.txt:
(F16,9,8000) (Mic20,6,3000) (SU30,8,5000) (B52,5,4000) (T30,4,9000)
(F16,9,8000) (Airbus A300,300,2000) (Mic20,6,3000) (SU30,8,5000) (852,5,4000)(T30,4,9000) (Boeing747,400,1500)
void f3()- Suppose the list contains at least 5 elements. Swap the element at position 1 with the element at position 4 (the head's position is 0). Output in the file f3.txt must be the following.
(Hint: You only need to swap the data between 2 nodes, not necessarily swap 2 nodes.)
ERF
Content of the file f3.txt:
(C,9,2000) (D,2,5000) (E,8,7000) (F,1,6000) (G,5,9000) (H,6,4000)
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Thanh Loan1
Ngày thêm
Lượt xem
1,013
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_Fall-2023_HCM_Ca_2_1980.webp
File size
144.4 KB
Dimensions
1552px x 621px

Share this media

Back
Bên trên Bottom