Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*************************************************************************************** CODE IN JAVA *************************************************************************************** PLEASE POST OUTPUT AS WELL *************************************************************************************** Task 2: Create a superclass named Publication that contains the following information: Attributes :

image text in transcribed

***************************************************************************************

CODE IN JAVA

***************************************************************************************

PLEASE POST OUTPUT AS WELL

***************************************************************************************

Task 2: Create a superclass named Publication that contains the following information: Attributes : String id String title double price //publication id //publication title 1/publication price Methods: public Publication (int, String, double); public String getID(); public String getTitle(); public double getPrice (); public void dispPublication(); a) Complete the Publication class definition above. b) Create a new class Book that inherits from Publication class and has new attributes number of pages and price per page. Book has a method named calcPricel) that will calculate and return the total cost of publication for the book. (total cost = number of pages * price per page * price of publication) c) Write Java application named BookApp to do the following: i. Declare a Book array and the size is entered by user ii. Input the book data and store in the array iii. Find the average cost of all book objects input into an array. iv. Count how many books that has total cost more than RM2,000 V. Display the publication information based on the ID entered by user, display an error message if ID is not found

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago