Tên pakage: QIS_TênSinhViên_Đề VD: QIS_LeVanTuan_02
Thư mục lưu bài sau khi làm xong: cutt.ly/10FLMs2
Write a book management program as shown in the figure:
1. Define interface IBOOK with methods: Calculate_Total()
Where Calculate_Total() is calculated as: - With TEXTBOOK Total = quantity* unitPrice – Discount; - With REFERENCEBOOK - Total = quantity* unitPrice + tax– Discount;
2. Construct an abstract class BOOK implements interface IBOOK. It contains:
- properties: bookID, publisher, entryDate, unitPrice, quantity - Getter methods for: bookID, publisher, entryDate, unitPrice, quantity - Setter methods for: bookID, publisher, entryDate, unitPrice, quantity - The methods: Input(), Output() - Abstract methods: Calculate_Discount() is calculated as: o With TEXTBOOK If the status is new: Discount= quantity* unitPrice*10%; If the status is old: Discount= quantity* unitPrice*50%; o With REFERENCEBOOK Discount= quantity* unitPrice*5%; 3. Define a class TEXTBOOK extends BOOK contains: - properties: status - Getter methods for: status - Setter methods for: status - The methods: Input(), Output(), Calculate_Discount(), Calculate_Total()
4. Define a class REFERENCE_BOOK extends BOOK contains:
- properties: tax - Getter methods for: tax - Setter methods for: tax - The methods: Input(), Output(), Calculate_Discount(), Calculate_Total() 5. Define a class named BOOKLIST as shown in the figure. It contains: - A variable: Book[] arr that contains list of books. - And perform the functions as: o Read all book from data.txt file o Write book from array to file o Find a book based on bookID; o Calculate sum of total