Question: JAVA 1. Create a base class called Book. It should keep track of the following data items (you need to decide on the data type

JAVA

1. Create a base class called Book. It should keep track of the following data items (you need to decide on the data type for each data item):

- Title

- Author

- Publication Year

- Number of pages

- Medium (0 - printed hardcover, 1- printed softcover, 2- electronic, 3 - all)

- Number of copies printed

- Production cost (i.e. the sum of all production expenses such as licensing, royalties, printing cost, etc.)

- Sale price (i.e. what does the book sell for, e.g. $7.95/copy)

- Number of copies sold

- Number of positive reviews

- Number of negative reviews

The class should have appropriate constructors, getters, setters, and a PrintInfo() method.

2. Create a class Textbook, derived from Book. The class inherits everything from the parent class and adds the following data (and appropriate methods):

- Field (e.g. Computer Science, Biology, etc.)

- Topic (e.g. Computer Architecture, Molecular Modeling, etc.)

3. Create a class Novel, derived from Book. The class inherits everything from the parent class and adds the following data (and appropriate methods):

- Genre (i.e. Sci-fi, Thriller, etc.)

4. Create an interface called PublicationInfo, which declares methods:

- CostEffective(): This method, when implemented in a class should return true if the book is cost-effective, i.e. if the funds received from the sale of the book exceeds the production expenses. Otherwise return false.

- GeneratesInterest(): The method, when implemented in a class, should return true if the number of positive reviews exceeds the number of negative review and if the number of sales exceeds a certain threshold (for example, when implemented in the Textbook class, the threshold 80% of the copies printed, whereas for novels, the threshold should be set to a larger number, say 65% of the copies printed). Both class Textbook and Novel should implement the methods of the PublicationInfo interface.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!