Question
Book Class 1) Create an abstract class named Book a. Include fields for title, price, and publishingDate b. Include a constructor that requires the book
Book Class 1) Create an abstract class named Book a. Include fields for title, price, and publishingDate b. Include a constructor that requires the book title, isbn, and date of publishing. 2) Adkl get methods to return title, isbn, publisher, price, and date of publishing. Include set methods for title, isbn, publisher, price, and date of publishing. ) Set method for price is an ahstract method 5) Include an abstract method calculateCharge that accepes quantity sold and returns total 6) Include toString0 method. Spring 2018 MIS 120 isbn: String publisher: String price: double quantty int +Book (t: String, i: String. dop +getTitle(: String +sett lelt: Stringl: void +seti5BN (ison: String): void +getiSBN 0:String +setPublisher (p : String) : woid +getPublisher O :String +setPublishDate(dop:Date): void getPrice0: double + getQuantty): int +setOuantityiq: int) void price:double Fiction t:String,:String, pub : String,NonFictiont:String,i:String dop Date, p:double) + setPricelp: double) void pub: String, dop Date, p: double) +setPricelp: double): void Fiction and NonPiction Classes 1) Create two sub classes of Book: Fiction and NonFiction. a. Each must include a setPrice0 method that sets the price. b. Include calculateCharge method in each of the subdasses that implements calculateCharge from Book class. Include 7.25% tax for Fiction books. There is not tax for Non Fiction books c. Indlude toString in each class. d. Write a constructor for each subelass, and include a call to setPrice) within each. 2) Write a demo program called BooksDemo a. Create one fiction and one non fiction book and display all fields using toStringO Spring 2018 MIS 120 Sample Output Fiction Title The Hideaway ISBN0718084225 Publication Date: April 11, 2017 Publisher: Thonas Ne1son Price 9.23 Quantity5 Book class hierarchy is defined as given in the UML diagram. Book Class 1) Create an abstract class named Book. a. Include fields for title, price, and publishingDate b. Include a constructor that requires the book title, isbn, and date of publishing. 2) Add get methods to return title, isbn, publisher, price, and date of publishing. 3) Include set methods for title, isbn, publisher, price, and date of publishing. 4) Set method for price is an abstract method 5) Include an abstract method calculateCharge that accepts quantity sold and returns total charge. 6) Include toString() method. Fiction and NonFiction Classes 1) Create two sub classes of Book: Fiction and NonFiction. a. Each must include a setPrice() method that sets the price. b. Include calculateCharge method in each of the subclasses that implements calculateCharge from Book class. Include 7.25% tax for Fiction books. There is not tax for Non-Fiction books c. Include toString() in each class. d. Write a constructor for each subclass, and include a call to setPrice() within each. 2) Write a demo program called BooksDemo. a. Create one fiction and one non-fiction book and display all fields using toString() methods. Spring 2018 MIS 120 HW-4 4 Sample Output Fiction ------- Title : The Hideaway ISBN : 0718084225 Publication Date: April 11, 2017 Publisher: Thomas Nelson Price : 9.23 Quantity : 5 Total Price : 46.15 Non-Fiction ----------- Title : Into Thin Air: A Personal Account of the Mt. Everest Disaster ISBN : 978-0385494786 Publication Date: July 6, 2011 Publisher: Pan Price : 11.41 Quantity : 3 Total Price : 34.23
Book Class 1) Create an abstract class named Book a. Include fields for title, price, and publishingDate b. Include a constructor that requires the book title, isbn, and date of publishing. 2) Adkl get methods to return title, isbn, publisher, price, and date of publishing. Include set methods for title, isbn, publisher, price, and date of publishing. ) Set method for price is an ahstract method 5) Include an abstract method calculateCharge that accepes quantity sold and returns total 6) Include toString0 method. Spring 2018 MIS 120 isbn: String publisher: String price: double quantty int +Book (t: String, i: String. dop +getTitle(: String +sett lelt: Stringl: void +seti5BN (ison: String): void +getiSBN 0:String +setPublisher (p : String) : woid +getPublisher O :String +setPublishDate(dop:Date): void getPrice0: double + getQuantty): int +setOuantityiq: int) void price:double Fiction t:String,:String, pub : String,NonFictiont:String,i:String dop Date, p:double) + setPricelp: double) void pub: String, dop Date, p: double) +setPricelp: double): void Fiction and NonPiction Classes 1) Create two sub classes of Book: Fiction and NonFiction. a. Each must include a setPrice0 method that sets the price. b. Include calculateCharge method in each of the subdasses that implements calculateCharge from Book class. Include 7.25% tax for Fiction books. There is not tax for Non Fiction books c. Indlude toString in each class. d. Write a constructor for each subelass, and include a call to setPrice) within each. 2) Write a demo program called BooksDemo a. Create one fiction and one non fiction book and display all fields using toStringO Spring 2018 MIS 120 Sample Output Fiction Title The Hideaway ISBN0718084225 Publication Date: April 11, 2017 Publisher: Thonas Ne1son Price 9.23 Quantity5Step 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