Question
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
3.59 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
package firstfirst import javaioBufferedReader import javaioFile import javaioFileNotFoundException import javaioFileReader import javaioIOException import javatextParseException import javatextSimple...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