Construct an abstract class named Book. Include a String attribute for the title and a double attribute for the price. Within the class, include a constructor that requires the title. Add two get...


Construct an abstract class named Book. Include a String attribute for the title and a double<br>attribute for the price. Within the class, include a constructor that requires the title. Add two get<br>methods, one that returns the title and one that returns the price. Include an abstract method<br>named setPrice(). Create two child classes of Book namely Fiction and NonFiction. Each must<br>include a setPrice() method that sets the price for all Fiction books to $24.99 and all NonFiction<br>books to $37.99. Write a constructor for each subclass. Write an application demonstrating that<br>you can create a Fiction titled

Extracted text: Construct an abstract class named Book. Include a String attribute for the title and a double attribute for the price. Within the class, include a constructor that requires the title. Add two get methods, one that returns the title and one that returns the price. Include an abstract method named setPrice(). Create two child classes of Book namely Fiction and NonFiction. Each must include a setPrice() method that sets the price for all Fiction books to $24.99 and all NonFiction books to $37.99. Write a constructor for each subclass. Write an application demonstrating that you can create a Fiction titled "LOTR" anda NonFiction titled "OOP". Set the price and display all the attributes of each object.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here