$15.00 Book class question
- From Computer-Science: Object-Oriented-Programming
- Closed, but you can still post tutorials
- Due on Nov. 13, 2009
- Asked on Nov 01, 2009 at 9:00:36PM
Q:I have my code but I don't like my solution. It prints the information that is written into the code and I'd prefer it to be written from a separate text file. Here is the question.
Create a Book class that stores book information. Your book class will store book title, author’s first name, author’s last name, book ISBN-10 number, and publisher, and price. Ensure you have created appropriate constructor(s) that will allow your test application to construct objects of type Book.
You can decide how to obtain the information used for each Book object you create. Each book’s information can be entered through the keyboard, read in from a file, or constructed by using hard coded values in your test application.
Create a test application that creates several objects of type Book class and adds each Book object to an ArrayList. Do not store your book information as a String and add this String into your ArrayList. You should store Book objects that encapsulate your book information and store these in your ArrayList:
//Creates arrayList to store book objects
ArrayList bookList = new ArrayList();Your test application should then do the following:
- Iterate through all Books in the ArrayList and print the information out in readable form.
- Print the total number of books stored.
- Prompt you for an index and print the book information stored in the index.
Hint: You may want to look into overriding toString() method to provide a readable string representation of Book object.
Attachments:Book.zip (15K)



