Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a java program for a publisher. The Publisher class will have a name, number of staff members, types of publications (books, magazines, videos). Book

Write a java program for a publisher. The Publisher class will have a name, number of staff members, types of publications (books, magazines, videos). Book and Magazine are subclasses of Publisher. The instance variables of Book class are title, price, type (fiction or non-fiction), and year of publication. Magazine should have name of the magazine, type (monthly, weekly, yearly), and price per magazine. Each of the classes must have constructors, get() & set() methods, and toString() method. Book and Magazine classes must each have a charge() method that will accept either the number of books bought or number of subscriptions in the case of magazines and return the total charges. Book class must have a search() method which accepts a title and an array of Book objects, and prints a message as the book is available or not. Magazine class must also have a search() method that receives a type and an array of Magazine objects and print all the magazines with that type (if the type is weekly, it should print all the weekly magazines available from this publisher). Include a driver to test the classes. You should have two text files: one of the books and the other of magazines. The driver should read these into appropriate arrays. The main() should print a menu of all the choices.

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions