I need a complete Java code for the following beginner-level assignment. The code does not have to be pretty as long as it works... So here's the assignment:
You run a small library. Ask the user to provide information for several books. The information must include the author, title and publisher of each book. Create a book class which stores the information and implements the following methods:
getAuthor() (returns author's name)
getTitle() (returns the title)
getPublisher() (returns the publisher of the book)
Finally print all the stored information to the user.
Tip 1: Remember the constructor.
Tip 2: You can use an arraylist.
This is how it should look like:
Do you want to input a new book (y/n)?
y
Author:
Jacob Smith
Book title:
Investment Banking
Publisher:
Oxford Press
Do you want to input a new book (y/n)?
y
Author:
Mary Dickins
Book title:
Advanced Econometrics
Publisher:
London Publishing House
Do you want to input a new book (y/n)?
n
The library contains:
2 books
Books:
Jacob Smith, Investment Banking, Oxford Press
Mary Dickins, Advanced Econometrics, London Publishing House