Question

You need to program a simple book library system. There are three java classes Book.java   //...

You need to program a simple book library system.

There are three java classes

Book.java   // book object class

Library.java   //library class

A2.java //for testing

The Book.java class represents book objects which contain the following fields

title: a string which represents the book title.

author: a string to hold the book author name

year: book publication year

isbn: a string of 10 numeric numbers.

The book class will have also 3 constructors.

-The default no argument constructor

- A constructor which takes the title and author names only

-A constructor which takes title, author and,year

For the book class, you need to add all setters and getters methods such as

setTitle / getTitle

setAuthor/getAuthor

setYear/getYear

setISBN/getISBN

finally, define a bookInfo() method which will print the book information in the following format

Book Title: “book title”

Author(S): author

Publication Year : the year

ISBN : the isbn number

The Library.java class

The library class will have the following fields

- An integer MAXCAPACITY.
which represent the maximum number of book that the library can hold. If the library is full, no more books can be added and a warning message will be displayed.
- capacity which represents the number of the books currently in the library. Every time a new book is added, capacity should be incremented.
- storage
This is basically an array of class book. It can hold only up to maximum capacity books.
- name
a string which will represent the library name. Example “ Future Library”

The library class will have the following methods

Library( String name, int Capacity)
A constructor which will take library name and maximum capacity as input and initialize the library storage and then display a welcoming message indicating the library name and capacity. Example

- “Welcome to Future Library”
- I can hold upto 100 books.

Class Library methods

- addbook( Book aBook ) will add a book. Each time a new book is added the capacity should be increased by one.
- -search (Book a Book, String title) will search for a book according to its title and will return true if it is in the library and false otherwise.

A2.java is a simple test class where you need to test the implemented code by establishing a library and adding books to it.

Page | 3

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
You need to program a simple book library system. There are three java classes Book.java   //...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (JAVA NetBeans) Write programs in java Example 9.13~9.15 //Book.Java public class Book { private String title; private...

    (JAVA NetBeans) Write programs in java Example 9.13~9.15 //Book.Java public class Book { private String title; private String author; private double price; /** * default constructor */ public Book() { title = ""; author = ""; price = 0.0; } /** * overloaded constructor * * @param newTitle the value to assign to title * @param newAuthor the value to assign to author * @param newPrice the value to assign to price */ public Book(String newTitle, String newAuthor, double newPrice)...

  • You are going to model a Book in a library. The Book class should contain a...

    You are going to model a Book in a library. The Book class should contain a title and an author (exactly 1 author is OK). Also, a book can be checked out and returned by a student. A Book object should be able to identify the student who currently holds the book. 1.Design the public interface (public constructor and public methods) for a class Book. You can use String to represent title, author, and student. 2. Implement the class Book...

  • Java Programming Exercise: Creating and implementing a UML class diagram The inventory of a library is...

    Java Programming Exercise: Creating and implementing a UML class diagram The inventory of a library is a set of media. Media can be books, CDs and films. Each medium has a unique alphanumeric ID, a title, a year of publication and the date on which it was purchased. Each book also has an author and an ISBN. For each CD the artist and the number of titles are saved. Each movie has a genre and a format: either DVD or...

  • Programming language: Java Design an application that has three classes. The first one, named Book describes...

    Programming language: Java Design an application that has three classes. The first one, named Book describes book object and has title and number of pages instance variables, constructor to initialize their values, getter methods to get their values, method to String to provide String representation of book object, and method is Long that returns true if book has over 300 pages, and returns false othewise. Provide also method char firstChard) that returns first cahracter of the book's title. The second...

  • Create a Python file (book.py) that has a class named Book. Book class has four attributes,...

    Create a Python file (book.py) that has a class named Book. Book class has four attributes, title (string), author(string), isbn(string), and year(int). Title - the name of the book. Author - the name of the persons who wrote the book. ISBN - is a unique 13 digit commercial book identifier. Year - the year the title was printed. Your class should have the following methods: (1) __init__(self, title, author, isbn, year): This method called when an object (book) is created...

  • Create a Python file (book.py) that has a class named Book. Book class has four attributes, title...

    Create a Python file (book.py) that has a class named Book. Book class has four attributes, title (string), author(string), isbn(string), and year(int). Title - the name of the book. Author - the name of the persons who wrote the book. ISBN - is a unique 13 digit commercial book identifier. Year - the year the title was printed. Your class should have the following methods: (1) __init__(self, title, author, isbn, year): This method called when an object (book) is created...

  • Subject: Java Program You are writing a simple library checkout system to be used by a...

    Subject: Java Program You are writing a simple library checkout system to be used by a librarian. You will need the following classes: Patron - A patron has a first and last name, can borrow a book, return a book, and keeps track of the books they currently have checked out (an array or ArrayList of books). The first and last names can be updated and retrieved. However, a patron can only have up to 3 books checked out at...

  • C++ In this homework, you will implement a single linked list to store a list of computer science textbooks. Ever...

    C++ In this homework, you will implement a single linked list to store a list of computer science textbooks. Every book has a title, author, and an ISBN number. You will create 2 classes: Textbook and Library. Textbook class should have all above attributes and also a "next" pointer. Textbook Туре String String String Attribute title author ISBN Textbook* next Library class should have a head node as an attribute to keep the list of the books. Also, following member...

  • Implement the classes in the following class diagram. The Book class implements the Comparable interface. Use impl...

    Implement the classes in the following class diagram. The Book class implements the Comparable interface. Use implements Comparable<Book> in the class definition. Now, all book objects are instances of the java.lang.Comparable interface. Write a test program that creates an array of ten books. 1. Use Arrays.sort( Book[]l books) from the java.util package to sort the array. The order of objects in the array is determined using compareTo...) method. 2. Write a method that returns the most expensive book in the...

  • Using C++ Skills Required Create and use classes Exception Handling, Read and write files, work vectors....

    Using C++ Skills Required Create and use classes Exception Handling, Read and write files, work vectors. Create Functions, include headers and other files, Loops(while, for), conditional(if, switch), datatypes,  etc. Assignment You work at the computer science library, and your boss just bought a bunch of new books for the library! All of the new books need to be cataloged and sorted back on the shelf. You don’t need to keep track of which customer has the book or not, just whether...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT