PRO192_-_PE02_-_SU_2025_4005.webp
T

PRO192_-_PE02_-_SU_2025_4005.webp

Question 1: (2 marks)
☑Kizspy.me
2 of 3
Paper No: 1
Do not pay attention to the real meaning of objects, variables, and their values in the questions below.
Write a class Book (in the default package of the NetBeans) with the following information:
id:int
- title:String
- author: String
-pageCount:int
Book
+Book(id:int, title: String,
author:String, pageCount:int)
+getTitle():String
+getAuthor():String
+toString():String
Where:
Book(id:int, title:String, author:String,
pageCount:int) - parameterized constructor, which
sets values to id, title, author, and pageCount. If
pageCount is less than 100 then set it to 100
getTitle():String return the title in uppercase
format if its length is at least 6 characters; otherwise
return "N/A".
getAuthor():String - if author is empty then return
"N/A", otherwise return author is in uppercase
format.
toString(): String return a string format that
contains all the information of the book: id, title,
author, and pageCount. The title and author in
uppercase
Do not format the result.
Zoom
The program output might look something like this:
F.100
+100%
Pakold100
100
Enterid 100
Close

Thông tin

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

Share this media

Back
Bên trên Bottom