Q1_20251109103353.webp
May76

Q1_20251109103353.webp

  • Media owner May76
  • Ngày thêm
3 of 3
Paper No: 3
(3 marks) Write a class Book with the following information:
Book
-author:String
-page:int
Where:

getAuthor():String - return author.

+Book ()

getPage():int-return page.
setAuthor(author:String): void - update author.
+Book (author:String, page:int)

setPage(page:int): void - update page.
+getAuthor:String
+getPage():int
+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);
Zoom
- FUO
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
+ 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,009
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom