diff_months: 21

CS301/CS600 Data Structures and Algorithms Assignment

Flat 50% Off Order New Solution
Added on: 2022-08-20 00:00:00
Order Code:
Question Task Id: 406278
  • Country :

    United States America


You task is to create a package BookPrinting, which implements a class hierarchy as follows:


TASK1

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):


1.Title


2Author


3Publication Year


4Number of pages


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


6Number of copies printed


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


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


9Number of copies sold


10Number of positive reviews


11Number of negative reviews


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


TASK 2

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


1Field (e.g. “Computer Science”, “Biology”, etc.)


2Topic (e.g. “Computer Architecture”, “Molecular Modeling”, etc.)


TASK 3

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


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


2Create 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.


Create a driver class Bookshelf. The class should contain a main method, which:


Opens a file called “data.txt”. Each line in that file will contain data about one book. For example:


“OpenGL”, M. Turner, 2020, 498, 3, 14000, 14995, 5.65, 12412, 581, 233, Computer Science, Computer Graphics


The entries are comma-separated, and listed in the order in section 1 above.


Parse each line in the file, determine the type of book the line represents, and then create a new instance of the TextBook or Novel class and initialize it with data from the current line. Add the new instance to an arrayList of type Book.


After all the data from the file has been read, print the contents of the arrayList one book at a time.


Have fun!

  • Uploaded By : Katthy Wills
  • Posted on : March 03rd, 2022
  • Downloads : 0
  • Views : 157

Order New Solution

Can't find what you're looking for?

Whatsapp Tap to ChatGet instant assistance

Choose a Plan

Premium

80 USD
  • All in Gold, plus:
  • 30-minute live one-to-one session with an expert
    • Understanding Marking Rubric
    • Understanding task requirements
    • Structuring & Formatting
    • Referencing & Citing
Most
Popular

Gold

30 50 USD
  • Get the Full Used Solution
    (Solution is already submitted and 100% plagiarised.
    Can only be used for reference purposes)
Save 33%

Silver

20 USD
  • Journals
  • Peer-Reviewed Articles
  • Books
  • Various other Data Sources – ProQuest, Informit, Scopus, Academic Search Complete, EBSCO, Exerpta Medica Database, and more