Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IMPORTANT NOTE: IN THIS ASSIGNMENT, YOU ARE NOT PERMITTED TO USE ANY OF THE JAVA BUILTIN CLASSES SUCH AS ArrayLists, LinkedList, HashMaps, etc. Using any
IMPORTANT NOTE: IN THIS ASSIGNMENT, YOU ARE NOT PERMITTED TO USE ANY OF THE JAVA BUILTIN CLASSES SUCH AS ArrayLists, LinkedList, HashMaps, etc. Using any of these will result in zero marks!
you can use the classes String and Scanner.
Description
FunReadings Library is asking you to write a Java program that manages all the items in their library and their leases as well as returns to and from clients. Your program is to be used only by library employees, and not clients. The library has books, journals, and media for example: DVDs All items have an ID a name, authors and year of publication. A client has an ID name, phone number, and
email address. There might be many copies from each item in the library. However, different copies will have different IDs. In general, an items ID is unique.
A journal also has a volume number a book has number of pages while a media has a typeaudiovideointeractive Books IDs start with Beg B B journals IDs start with Jeg J J Media IDs start with Meg M M A good menu should be provided so that
the user of your program can perform the following operations:
add an item, delete an item, change information of an item, list all items in a specific
category book journal, or media and print all items from all categories
add a client, edit a client, and delete a client.
lease an item to a client and return an item from a client.
show all items leased by a client.
show all leased items by all clients
Display the biggest book see below
Make a copy of the books array see below
Part I: UML
Draw a single UML representation for the hierarchy of the abovementioned classes. Your representation must also be accurate in terms of UML representation of the different entities and the relation between them. You must use software to draw your UML diagrams no handwritinghand drawing is allowed In case additional classes andor data attributes are needed to reflect how the above classes are related in reallife, you can add these classes.
Part II: Implementation
Implement the abovementioned classes using inheritance and according to the specificationsrequirements stated below:
You must have different Java packages for the classes: the first package will include the driver class, the second package will include the class for client, and the other classes will reside in the third package.
For each of the classes, you must have at least three constructors, a default constructor, a parameterized constructor which will accept enough parameters to initialize ALL the attributes of the created object from this class and a copy constructor. For instance, if any of these classes has attributes including the ID then the parameterized constructor must accept constructor creates a new object that is an exact copy of the passed object, with the exception of the ID
An object creation using the default constructor must trigger the default constructor of its ancestor classes, while creation using parameterized constructors must trigger the parameterized constructors of the ancestors.
For each of the classes, you must include at least the following methods: accessors, mutators, toString and equals methods.
The toString method must return a clear description and information of each object
The equals method must first verify if the passed object to compare to is null and if it is of a different type than the calling object. The method would clearly return false if any of these conditions is true. Otherwise, it compares all the attributes EXCEPT the ID to see if the two objects are equal.
For all classes, you must use the appropriate access rights, which allow most ease of useacce parameters to initialize all its attributes the ID is set automatically. The copy s without compromising Information Hiding Do not use most restrictive rights unless they make sense!
When accessing attributes from a base class, you must take full advantage of the permitted rights. For instance, if you can directly access an attribute by name from a base class, then you must do so instead of calling a public method from that base class to access the attribute.
Write a driver program that contains the main method which will utilize all of your classes, and trigger the execution of all the methods you have written. You should always keep in mind that if a code is written but never triggered and tested, then it may not work correctly when needed; so test all your code!
Besides the main method, the driver will also include two more methods:
A method called getBiggestBook which, as the name suggests, will find the book with the highest number of pages. If many books have the same highest number of pages, the method can return anyone of them.
call the getBiggestBook with the array of books and display the result.
Finally, call the method copyBooks
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