Question
Asked by:
mityguy23
mityguy23
Rating : No Rating
Questions Asked: 42
Tutorials Posted: 0
 

$12.00 java help

Q:
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<Book> bookList = new ArrayList<Book>();

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.
please wwrite this code in oop format, so a main class and a test class

thanks
 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
 

$10.00 Perfect A+ solution

  • This tutorial was purchased 1 time and rated A+ by students like you.
  • Posted on Aug 04, 2009 at 4:19:45PM
A:
Preview: ... ode,pub,tit;<br> float price;<br> <br> int bookno,booksize; // booksize total no. of books stored<br> // bookno used for index<br> <br> String ch; // gets decision from user to continue<br> <br> ArrayList<book> booklst=new ArrayList<book>(); // stores book information<br> <br> DataInputStream in=new DataInputStream(System.in);<br> <br> booksize=0; // intialize size of book as 0<br> do<br> { <br> booksize++; ...

The full tutorial is about 216 words long plus attachments.

Attachments:
books.java (3K) (Preview)
RESULT.JPG (31K) (Preview)
Posted by:
 

$12.00 Java Book Class - Good working

  • This tutorial hasn't been purchased yet.
  • Posted on Aug 05, 2009 at 05:53:29PM
A:
Preview: ... Hi this java program ...

The full tutorial is about 19 words long plus attachments.

Attachments:
BookClass.zip (54K)
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$15.00 Java: BookInventory, ArrayList<Book>, Scanner input, NetBeans folder, UseNotes, consoleOutput

  • This tutorial hasn't been purchased yet.
  • Posted on Aug 05, 2009 at 10:16:30PM
A:
Preview: ... e());<br> }<br><br> public static void bookInfoAtIndex() {<br><br> System.out.print(<br> "Enter index of book: ");<br> try {<br> int index = Integer.parseInt(keyboard.nextLine());<br> index--; // ArrayList indexed from 0, people use 1<br> if (index < 0 || index > bookList.size() - 1) {<br> System.out.println(<br> "Invalid index, you will be returned to the main menu.");<br> return;<br> }<br> System.out.println(bookList.get(index).toString());<br> return;<br> } catch (Exception e) {<br> System.out.println(e.toString());<br><br> }<br> }<br><br> @Override<br> public String toString() {<br> return new String(<br> String.format(<br> "%-15s %-15s\\n%-15s %-15s\\n%-15s %-15s\\n" +<br> "%-15s %-15s\\n%-15s %-15s\\n%-15s %-7.2f",<br> "Title: ", this.getTitle(),<br> "First Name: ", this.getAuthorFirstName(),<br> "Last Name ", this.getAuthorLastName(),<br> "ISBM; ", this.ISBN,<br> "Publisher: ", this.publisher,<br> "Price: ", this.price) + "\\n");<br> }<br>}<br>******** and the driver class, with main() *********<br><br>import java.util.Scanner;<br><br>public class BookDemo {<br><br> public static Scanner kb = new Scanner(System.in);<br><br> public static void main(String[] args) {<br><br> System.out.println(<br> "\\n\\tBook Inventory Program");<br><br> // read in the book data file:<br> Book.readInventoryFile();<br><br> // just to show how do do it, add another book:<br> // the book constructed is anonymous, it has no identifier,<br> // it doesn't need one!<br> Book.bookList.add(<br> new Book ...

The full tutorial is about 3068 words long plus attachments.

Attachments:
BookInventoryConsole.txt (2K) (Preview)
consoleOutputPrnScr.JPG (32K) (Preview)
BookInventoryUseNotes.txt (9K) (Preview)
BookInventoryZipped.zip (40K)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty