Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. a. Create an abstract class named Book. Include a String field for the book's title and a double field for the book's price. Within
1. a. Create an abstract class named Book. Include a String field for the book's title and a double field for the book's price. Within the class, include a constructor that requires the book title, and add two get methods one that returns the title and one that returns the price. Include an abstract method named setPriceo Create two child classes of Book: Fiction and NonFiction. Each must include a setPriceO method that sets the price for all Fiction Books to $24.99 and for all NonFiction Books to $37.99. Write a constructor for each subclass, and include a call to setPrice C) within each. Write an application demonstrating that you can create both a Fiction and a NonFiction Book, and display their fields. Save the files as Book.java, Fiction.java, NonFiction.java, and UseBook.java b. Write an application named BookAnray in which you create an array that holds 10 Books, some Fiction and some NonFiction. Using a for loop, display details about all 10 books. Save the file as Book Array java
Step 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