Kizspy.me
3 of 4
Paper No: 1
Base on given class diagram, create all Abstract class and class
1. Interface IBook
•
entry () method
• print () method
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
For example:
(id, name) is added
(textbook,sach giao khoa) is added
print() method: return a string that contains BookCategory information
For example:
(id, name)
(textbook,sach giao khoa)
3. Class Book implements IBook
•
Declare fields of class
•
Default constructor: Book()
Zoom
•
•
•
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:
+ 100%
Close