20251108144455.webp
Q

20251108144455.webp

Question paper (build 07.05.20.19)
}
public void f2(List<Coffee> t);
public void f3(List<Coffee> t);
Write a class MyCoffee, which implements the interface ICoffee. The class MyCoffee implements
methods f1, f2 and f3 in ICoffee as below (you can add other functions in MyCoffee class):
⚫ f1: Count and return number of elements whose name do ok't contain both of the character 'A'
and character 'B'.
⚫ f2: Remove the first element whose size is maximum.
f3: Sort the first 3 elements of the list t descendingly by unit digit of size (e.g. if size=123 then
unit digit-3).
When running, the program will add some data to the list. Sample output might look something like:
Add how many elements: 0
Enter TC(1-f1;2-f2;3-13): 1
The list before running f1:
Add how many elements: 0
Enter TC(1-11;2-12;3-13): 2
The list before running 12:
|(A,6) (B,9) (C,2) (D,9) (E,2) (F,9) (G,2)
OUTPUT:
(A,6) (C,2) (D,9) (E,2) (F,9) (G,2)
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
quangphc88
Ngày thêm
Lượt xem
2,680
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom