Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago