Answered step by step
Verified Expert Solution
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 :
***************************************************************************************
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 foundStep 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