Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The homework needed to be done using Inheritance Polymorphism. ABC Bookstore started its operation by selling physical and digital books. Each book has its ISBN,
The homework needed to be done using Inheritance Polymorphism.
ABC Bookstore started its operation by selling physical and digital books. Each book has its ISBN, title, and quantity. The company is planning to develop an application that can calculate an estimate price of books to forecast the profit. Estimated price for digital books depending on the size of memory (in kilobyte) consumed. A 10% discount is given to all digital books for every purchase on 22nd July annually in conjunction with digital awareness day. Estimated price of physical books is related to the number of pages and book's hardcover. Book ISBN: String -title: String - quantity : Int Book(String, String, int) setBook/String, String, int) : void getQuantity(): double + estimated Price() : double toString(): String Date -day: String - month : String -year: String Date(String, String, String) getDay(): String get Month(): String .getYear(): String DigitalBook -memorySize : int -ct: Date DigitalBook/String, String, int, int, Date) set DigitalBook(String, String, int, int, Date):void getDate(): String + estimatedPrice(): double toString : String PhysicalBook - numPage: int hardcover : boolean PhysicalBook/String, String, int, int, boolean) setPhysicalBook/String, String, int, int, boolean):void estimatedPrice(): double .toString(): String . . Write a complete class definition according to information given in UML template of each class that shown in the above diagram. The superclass Book is an abstract class that have an abstract method named estimate Price (). PhysicalBook and DigitalBook are the two subclasses that under Book as a superclass. Date class is an inner class (composite) for DigitalBook as an outer class. The definition of method estimatedPrice () for both subclasses are based on the information given in the following tables: Size of memory (kilobyte) Charge (RM) Less than 200 30.00 200 - 500 100.00 Every additional 30 kilobyte after 500 3.00 * 10% discount for purchases on 22nd July. Example date formatting is 22072021 (Day MonthYear). Number of pages Charge (RM) Less than 100 30.00 100 - 200 60.00 Every additional 30 pages after 200 5.00 Extra charge is RM10.00 for hardcover. Write the complete application program that can do the following tasks. i. Declare an array of object to store 100 objects of Book. ii. Using the sentinel concept, read the data until the user says no longer to read the data ji. Count and display the total number for each Digital and Physical book stored iv. Calculate and display the total of estimated price of all purchases on 22nd July. v. Count and display the number of books that has hardcover. vi. Display the information about every hardcover bookStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started