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

$15.00 CustomerHistory assignment

Q:

I have my code but it has an error.  I need help.  Below is the assignment.

 

Develop an application that will read and process customer history order information from an input text file, to determine total spent for each customer. The application will print a report of all customers and the total each spent. The report will be ordered by customer id.

Each record of the text file contains a customer ID, order number, and total of order. An example customer order file:

10051 1234567 150.00
10052 1234568 200.00
10051 1234569 120.00

Customer id should be the first field, order number should be the second field, and the amount of the order in dollars and cents (no commas) should be the third field. White spaces (no commas) should be used as the delimiter between each field and each customer order record should be in a separate line. Your file may be used as input to a future application which is why the format is important.

The file can contain several entries for the same customer ID. Your application should accumulate the total spent for each customer as you read the order information from the file. The application should print total spent for each customer to the screen using natural ordering of the customer id.

Refer to the various Lists, Sets, Maps, and Queues provide by the Sun Java API. Determine which data structure provided by the Java APIwould be the best choice for your application. Your grade will be based on your use of the class selected and your ability to select the most appropriate class to use based on the stated requirements.

 
Attachments:
CustomerHistory.zip (19K)


   
   
   
   
 
Available Tutorials to this Question
Posted by:
 

$15.00 A+ solution. Run corrently now.

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 29, 2009 at 01:22:23PM
A:
Preview: ... ease ...

The full tutorial is about 4 words long plus attachments.

Attachments:
CustomerFiles.java (3K) (Preview)
CustomerHistoryTest.java (0K) (Preview)
CustomerRecords.java (1K) (Preview)
Posted by:
Neel
Neel
Rating (237): C
Questions Asked: 0
Tutorials Posted: 1637, earned $2,000.41
 

$10.00 Solution

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 29, 2009 at 06:49:14PM
A:
Preview: ... I have atta ...

The full tutorial is about 9 words long plus attachments.

Attachments:
(0K)
Posted by:
Neel
Neel
Rating (237): C
Questions Asked: 0
Tutorials Posted: 1637, earned $2,000.41
 

$10.00 Solution

  • This tutorial hasn't been purchased yet.
  • Posted on Oct 29, 2009 at 06:51:45PM
A:
Preview: ... Please find it. Here is the link for ...

The full tutorial is about 28 words long .
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$15.00 Java: CustomerHistory, Scanner input, SortedMap<key,value>,NetBeans project, UseNotes, ScreenShot

  • This tutorial was purchased 1 time and hasn't been rated yet.
  • Posted on Oct. 31, 2009 at 12:19:23AM
A:
Preview: ... inFileName; // = "transdata2.txt";     private static Scanner inStream;     // This is the real key to this program: using a SortedMap     private static SortedMap sortMap = new TreeMap ();     // read & process transaction file:     public void readAndProcess() {         // keep reading until file is exhauster:         System.out.println("\n Processing transaction file:");         int count = 0;         while (inStream.hasNext()) {             count++;             String line = inStream.nextLine();             System.out.print(                     String.format(" %3d) ", count) + String.format("%-20s", line));             // tlkens are strings separated by 1 or moree spaces:             StringTokenizer strTokz = new StringTokenizer(line, " ");             try {                 // create Transaction object:                 Transaction transObj = new Transaction();                 // this is the map key:                 transObj.setId(Integer.parseInt(strTokz.nextToken()));                 // this is not stored in the map:                 transObj.setTransNum(Integer.parseInt(strTokz.nextToken()));                 // this is the map value:                 transObj.setAmount(Double.parseDouble(strTokz.nextToken() ...

The full tutorial is about 606 words long plus attachments.

Attachments:
CombinedSourceFiles.txt (6K) (Preview)
CustomerHistoryUseNotes.txt (4K) (Preview)
CustomerHistoryScreenShot.jpg (85K) (Preview)
CustomerHistoryZipped.zip (74K) 

 CustomerHistoryZipped/CustomerHistory/build.xml
 CustomerHistoryZipped/CustomerHistory/build/classes/.netbeans_automatic_build
 CustomerHistoryZipped/CustomerHistory/build/classes/CustomerHistoryDriver.class
 CustomerHistoryZipped/CustomerHistory/build/classes/CustomerHistoryLogic.class
 CustomerHistoryZipped/CustomerHistory/build/classes/Transaction.class
 CustomerHistoryZipped/CustomerHistory/dist/CustomerHistory.jar
 CustomerHistoryZipped/CustomerHistory/dist/README.TXT
 CustomerHistoryZipped/CustomerHistory/manifest.mf
 CustomerHistoryZipped/CustomerHistory/nbproject/build-impl.xml
 CustomerHistoryZipped/CustomerHistory/nbproject/genfiles.properties
 CustomerHistoryZipped/CustomerHistory/nbproject/private/private.properties
 CustomerHistoryZipped/CustomerHistory/nbproject/private/private.xml
 CustomerHistoryZipped/CustomerHistory/nbproject/project.properties
 CustomerHistoryZipped/CustomerHistory/nbproject/project.xml
 CustomerHistoryZipped/CustomerHistory/src/CustomerHistoryDriver.java
 CustomerHistoryZipped/CustomerHistory/src/CustomerHistoryLogic.java
 CustomerHistoryZipped/CustomerHistory/src/Transaction.java
 CustomerHistoryZipped/CustomerHistory/transdata2.txt
 CustomerHistoryZipped/CustomerHistory/transdata3.txt
 CustomerHistoryZipped/CustomerHistoryOutput.html
 CustomerHistoryZipped/CustomerHistoryOutput.txt
 CustomerHistoryZipped/CustomerHistoryScreenShot.jpg
 CustomerHistoryZipped/CustomerHistoryUseNotes.txt
 CustomerHistoryZipped/oldProgram.txt
 ]

   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty