Set methods for title, author, yop, and bookCategory.
Entry() method: return a string
Kizspy.me
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.
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"
2. PrintBookCategory
When the line start with a string "PrintBookCategory", if the list is not empty, print
out list of bookcategories with format string " (id, name)", else print "Empty".
3. AddBook, title, author, yop, bookCategory.id
4.
5.
When the line start with a string "AddBook", the program will find bookCategory base
on bookCategory.id and add new Add Book(title, author, yop, bookCategory) and
print out the string "(title) is added".
PrintBook
When the line start with a string "PrintBook", if the list is not empty, print out list of
books with format string " (title, author, yop): [bookCategory.name]", else
print "Empty".
SearchBook, book
When the line start with a string" SearchBook", the program will search book in the
Zoom
+ 100%
Close