Question: JAVA Programming Exercise 1) Super Class: Create a class Person private member variables firstName (String), lastName (String) Add public setter , getter and constructor with

JAVA Programming Exercise

1) Super Class: Create a class Person

private member variables firstName (String), lastName (String)

Add public setter , getter and constructor with parameters to class

Add public toString method

2) Inheritance: Create a class Author as a subclass of class Person

the class also has private member variable email (String)

Add public setter , getter and constructor with parameters to the class

Add public toString method by overriding the super class method

3) Composition: Create a class Book with

private member variables title (String), isbn (title), and author (Author). Note: though in real life a book can have a list of authors, in this lab we assumed that each book has a single author to simplify coding.

Add public setter , getter and constructor with parameters to the class

Add public toString method

4) Create a class Library

private member variables books (Book[] that is books is a one dimensional array of books), bookCount(int) where bookCount keeps track of actual number of books stored in the library.

Add a constructor with parameters to the class. Hint: The library has a capacity that can be set by the client program. So, you can write a constructor for class library that will take the capacity of the library as a parameter.

Add public method addNewBook method to the class: This method will add a new book to the array books. Note: When writing this method, also consider what to do when there is "no room" in the library to store a new book.

Add public method printBooks method to the class

5) Client Code: Create a class LibrarySimulation that will have the main function to do the following

create a new author object

create two book objects, both books have the same author created above

create a library object that can hold 10,000 books

add the two books to the library

print all the books in the library

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!