PRO192_-_PE_-_SP_2025_3481.webp
DucTai2004

PRO192_-_PE_-_SP_2025_3481.webp

Kizspy.me
Zoom
2. Class BookCategory implements IBook
• Declare fields of class
Default constructor: BookCategory()
Constructor: BookCategory(String id, String name)
set id=value of id, name-value of name.
• Get methods for id and name.
Set methods for id and name.
• entry () method: will return a string that contains added information
(id, name) is added
For example:
(textbook,sach giao khoa) is added
print() method: return a string that contains BookCategory information
(id, name)
For example: (textbook,sach giao khoa)
3. Class Book implements IBook



Declare fields of class
Default constructor: Book()
Constructor: Book(String title, String author, int yop, BookCategory bookCategory)
set title-value of title, author-value of author, bookCategory-value of bookCategory
Get methods for title, author, yop, and bookCategory.
Set methods for title, author, yop, and bookCategory.
Entry() method: return a string
For example:

(title) is added
(Lap trinh JAVA) is added
Print () method: return a string that contains Book information
For example:
4. Class Q1
(title, author, yop): [bookCategory.name]
(Lap trinh JAVA,Pham Quang Dung,2021):[sach tham khao]
Build program that read input file and print out the result into output file as following rule:
The input: are stored in the input.txt text file:
• The first line contains a positive integer T (1ST≤ 100) which is the number of test case.
⚫ The next T line contains one of 6 types:
1.
2.
AddBookCategory, id, name
When the line start with a string" AddBookCategory", the program will add new
BookCategory(id, name) to the list and print out the string "(id, name) is added"
Print BookCategory
+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Share this media

Back
Bên trên Bottom