+setAuthor(author:String):void
+setPage(page:int):void
The interface IBook below is already compiled and given in byte author format, thus you can use it
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)
(Ngọc 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