Question
Asked by:
missprince
missprince
Rating : No Rating
Questions Asked: 6
Tutorials Posted: 0
 

$15.00 Book info with more than a main

Q:

I have my code  and txt filr already but I need to figure out to make more than a main to ensure good Object oriented programing practices.

 

You have been tasked to develop an application that will read book information from a text file to determine which publishers you use. The application will print a report of all unique publishers used.

The input text file contains records with author first name, author last name, book ISBN-10 number, and publisher in this format:

Johnny Smith 0123456789 HarperCollins
Freddie Jones 0123456777 HarperCollins
Lilly Laine 0122222234 Penguin
Bobby Crosby 0111102345 Atlantic
Troy James 0119233334 Atlantic

Author first name should be the first field, author last name should be the second field, isbn should be the third field, and a one word publisher name should be the fourth field. White spaces (no commas) should be used as the delimiter between each field and each publisher record should be on a separate line. Your file may be used as input to a future application which is why the format is important.

This file could contain many books published by the same publisher. You need to read all records from the file and store only the publisher name into a data structure without duplicates. The publishers need to be sorted alphabetically.

When your application runs, it should read the input book information file and print to the screen all publisher names in alphabetical order by iterating through the data structure you used. No duplicate publisher names should be printed.

Refer to Collections in the Sun Java API Documentation. Determine which Collection implementation would be the best choice for your application. Your grade will be based on your use of the Collection class selected and your ability to select the most appropriate Collection to use based on the stated requirements.
Write an application that will satisfy the assignment requirements and test that it works.

The output to the screen should be in the following format:

Atlantic
Penguin
HarperCollins

Each publisher should be on a separate line and only the publisher name is printed, in alphabetical order, with no duplicates..

 
Attachments:
Publishers.zip (10K)


   
   
   
   
 
Available Tutorials to this Question
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$15.00 Java: 3 classes, read w/ Scanner, publisherName to SortedSet<String>, NetBeans folder, UseNotes

  • This tutorial was purchased 1 time and rated A+ by students like you.
  • Posted on Oct 26, 2009 at 9:47:34PM
A:
Preview: ... ld used for this exercise:             bookObj.setPublisher(strTok.nextToken());             // store just the publishers name in the sorted set:             ss.add(bookObj.getPublisher()); // this token is the publisher namep         }     }     public void displayResults() {         System.out.println("\nResults:\n" +                 "Alphabetical list of publishers in the Book Data File.\n" +                 "Each publisher appears once regardless of how many times " +                 "it appears in the file.\n");         int count = 0;         for (String name : ss) {             count++;             System.out.println(" " + count + ") " + name);         }         System.out.println("\n");     }     public void closeFile() {         inStream.close();     } }*************** file 3, the driver ************** public class PublishersDriver {     public static void main(String[] args) {         System.out.println( ...

The full tutorial is about 511 words long plus attachments.

Attachments:
Book.java (1K) (Preview)
PublishersOutput.jpg (100K) (Preview)
PublishersUseNotes.txt (4K) (Preview)
Publishers2Zipped.zip (80K) 

 Publishers2Zipped/Publishers/BookDataFile.txt
 Publishers2Zipped/Publishers/booklist.txt
 Publishers2Zipped/Publishers/build.xml
 Publishers2Zipped/Publishers/build/classes/.netbeans_automatic_build
 Publishers2Zipped/Publishers/build/classes/Book.class
 Publishers2Zipped/Publishers/build/classes/PublishersDriver.class
 Publishers2Zipped/Publishers/build/classes/PublishersLogic.class
 Publishers2Zipped/Publishers/dist/Publishers.jar
 Publishers2Zipped/Publishers/dist/README.TXT
 Publishers2Zipped/Publishers/manifest.mf
 Publishers2Zipped/Publishers/nbproject/build-impl.xml
 Publishers2Zipped/Publishers/nbproject/genfiles.properties
 Publishers2Zipped/Publishers/nbproject/private/private.properties
 Publishers2Zipped/Publishers/nbproject/private/private.xml
 Publishers2Zipped/Publishers/nbproject/project.properties
 Publishers2Zipped/Publishers/nbproject/project.xml
 Publishers2Zipped/Publishers/src/Book.java
 Publishers2Zipped/Publishers/src/PublishersDriver.java
 Publishers2Zipped/Publishers/src/PublishersLogic.java
 Publishers2Zipped/PublishersOutput.html
 Publishers2Zipped/PublishersOutput.jpg
 Publishers2Zipped/PublishersOutput.txt
 Publishers2Zipped/PublishersUseNotes.txt
 Publishers2Zipped/SortedSet.txt
 ]

Posted by:
 

$15.00 A+ Object oriented Solution updated from old code

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 26, 2009 at 10:19:39PM
A:
Preview: ... the a ...

The full tutorial is about 4 words long plus attachments.

Attachments:
Publishers.java (1K) (Preview)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty