Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PUBLICATION INHERITANCE - ARRAY Can you create an abstract publication class that will define a general publication. It will be too general for specific publications.

PUBLICATION INHERITANCE - ARRAY Can you create an abstract publication class that will define a general publication. It will be too general for specific publications. A publication properties will consist of: title price year The publication should be able to: initialize all data fields (arguments from the user input) when created raise the price by a certain percentage (that will be sent as a decimal argument) print all the labeled data fields (price to two decimal places) tell the user how to use the publication to look up a specific topic (but since a publication is too general, it will be abstract because we could not tell how to use it unless we have a specific kind of publication). You will then create two subclasses that Ais a@ publication, for a book and for a cd (audio book). Use what you inherit whenever possible. A book "is a" publication Also has a number of pages. Initialize all data fields (to the user input) by using the publication constructor for inherited fields. The use method will be to tell the user to look up their topic in the table of contents and turn to the corresponding page. The print method will label the output as a book and print all the labeled data fields (but use the publication's print method for the three inherited data fields). A cd "is a" publication Also has a number of minutes. Initialize all data fields (to the user input) by using the publication constructor for inherited fields. The use method will be to tell the user to look up their topic on the cd and skip to the corresponding section. The print method will be similar to the book print. You will then create a main class that will: Prompt the user for how many publications there are. Declare an array of abstract super references of publications of the size the user requested. Use a for loop. You will prompt and input all the data fields (asking the user what kind of publication for what added data to input and take upper or lowercase). Create the object and assign the object into the next reference in the array. Start a separate for loop. Call the method to raise each of the publication references by 10% (as a decimal amount argument). Call the print method (with dynamic method binding!) for each of the publication references. Call the use method (with dynamic method binding!) for each of the publication references. Document all java files with at least 4 lines of comments at the top and at least 5 comments throughout the code for all of the not easily understandable lines of code. Run your program with the data below. Submit your three class definitions, main program, and output .txt saved. PUBLICATION INHERITANCE - ARRAY - DATA Input: Enter number of publications: 2 Enter title: Java Reader Enter price: 17.50 Enter publication year: 2015 Is publication a Book (b) or CD (c): b Enter pages: 250 Enter title: Java Listener Enter price: 24.95 Enter publication year: 2016 Is publication a Book (b) or CD (c): C Enter minutes: 330 Output: Book Title is Java Reader Price is 19.25 Publication Year is 2015 Number of pages is 250 Open book to Table of Contents. Look up topic and turn to corresponding page. CD Title is Java Listener Price is 27.45 Publication Year is 2016 Number of minutes is 330 Look on CD to find topic number. Skip to corresponding section.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Describe three major categories of exempt purchasers.

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago