Q1_20251109103355.webp
May76

Q1_20251109103355.webp

  • Media owner May76
  • Ngày thêm
without creating IBook.java file.
import java.util.List;
public interface IBook {
public int fl(List<Book> t);
public void f2(List<Book> t);
public void f3(List<Book>t);
Write a class MyBook, which implements the interface IBook. The class MyBook implements methods
fl, f2 and 13 in IBook as below (you can add other functions in MyBook class):



f1: Find the maximum page of all Books in the list where the author contains at least two words.
f2: Sort the elements in the list Book ascendingly by page.
f3: Remove all Books where the Book author starts with a letter "N" and the Book page is equal
the minimum page of all Books in the list. (if there is no element that satisfies the conditions then
do nothing). (Must ensure that the list is updated in-place and maintain its original order for the
remaining elements)
When running, the program will add some data to the list. Sample output might look something like:
List before running test case:
(Nguyen Le, 210)
(Ta Tan, 50)
(Ngoc Hoa, 50)
Add how many elements:
1
Enter author:
List before running test case:
(Nguyen Le, 210)
(Ta Tan, 50)
(Ngoc Hoa, 50)
Add how many elements:
0
Enter TC:
1-fl: maximum page
2-12: sort by page
3-13: remove by condition
Your choice:
2
OUTPUT:
(Ta Tan, 50)
Zoom
- FUO
+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Share this media

Back
Bên trên Bottom