Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . Design a Library Management system as follows: a . Define a class name Author It has two instance variables: First name and Last
Design a Library Management system as follows:
a Define a class name Author
It has two instance variables: First name and Last Name
Write the set and get methods
Write the toString method
b Define a class named Publication
It has four instance variables:
title: the title of the Publication. It is a String value. The title must contain at least characters to be accepted.
publicationDate: an object of class Date see class LocalDate Appendix that specifies the date of publication. The year must be greater than for the date to be accepted.
numberOfAuthors: specifies the number of authors.
authors : an array of authors. Each author is an Author objects.
count: a static attribute used to calculates the number of created Publication objects. You must update count for each newly created object
The class Publication has one constructor with arguments String title, Author a LocalDate date that sets the values of the four instance variables to those passed as parameters. LocalDate class defined in the appendix below.
The class Publication has second constructor with arguments String title, int nbr LocalDate date that sets the values of instance variables to those passed as parameters and create the array of authors with nbr authors.
Finally, it defines the toString method that returns the string in the format author authortitle publicationDate
c Write a class Book that is derived from Publication.
This class contains one instance variable price, which is a double that specifies the price of the book.
The Book class has a method called compareToBook B that returns if that the Price of the Book B is strictly greater than the Price of the current book, and returns in the opposite case, and is both prices are equal.
d Create class TestPublication with a main method that produces the following output
Number of created books:
Book: Anis KoubaaBasit QurashiComputer Programming Price:
Book: Mohamed AffendiNetworking
The program must have the following operations:
Create three authors objects named author for Anis Koubaa author for Basit Qurashi and author for Mohamed Affendi
Create an array of authors that contains only two authors author and author
Create an array of authors that contains only one author author
Create an array books that contains two Book objects, with book attributes are provided in the program output above.
Display the output shown above.
Step 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