PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
Thúy Nga1

PRO192_-_PE_-_SU_2024_-_s_1_2167.webp

public void f2(List<Speaker> t);public void f3(List<Speaker> t);
Write a class MySpeaker, which implements the interface ISpeaker. The class MySpeaker implements methods f1, f2 and f3 in ISpeaker as below (you can add other functions in MySpeaker class):
f1: Count and return the number of speakers with power > 10.
f2: Sort the first 5 elements in the list ascendingly (other elements are unchanged).
f3: Check if in the list there are at least 2 elements having minimum power then remove the second one (thus if only one element with minimum power then do nothing).
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-f3): 1
Add how many elements: 0
Enter TC(1-fl;2-f2;3-13): 2 The list before running 12:
The list before running f1:(A2,8) (B1,2) (C3,16) (D4,17) (E5,6)
(A,6) (B,9) (C,2) (D,29) (E,22) (F,19) (G,12) (H,5)
OUTPUT:(C,2) (A,6) (B,9) (E,22) (D,29) (F,19) (G,12) (H,5)
}
4 of 4
Paper No: 1
OUTPUT:
< Zoom
>
90%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
File size
167.7 KB
Dimensions
916px x 988px

Share this media

Back
Bên trên Bottom