Question
Asked by:
nicholsbradley
nicholsbradley
Rating : No Rating
Questions Asked: 21
Tutorials Posted: 0
 

$10.00 Help please 7

Q:
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.

Write an application that will satisfy the assignment requirements and test that it works. For your discussion essay, explain in 1-2 paragraphs the class you chose to use and your reasons for your choice.

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

10051 270.00
10052 200.00

Each customer's information should be on a separate line with customer id and total spent printed for each. Your customer information should be ordered by customer id starting with the lowest customer id and ending with the highest.

When you submit your zipped NetBeans project folder, be sure you include the customer information file you used to test your application.

Before you write any Java code, start with planning comments also known as pseudocode. These comments will serve as the outline of your logic for each method including your test application. The comments should be left in your code and part of your grade will come from these comments.

 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
rawfile
rawfile
Rating (1): A+
Questions Asked: 0
Tutorials Posted: 2, earned $3.59
 

$6.00 NetBeans Project with Customer Information file & Reasons for the class used

  • This tutorial was purchased 1 time and rated A+ by students like you.
  • Posted on Jul 29, 2009 at 4:53:11PM
A:
Preview: ... zip file consists of the Netbeans project folder along with the cust ...

The full tutorial is about 58 words long plus attachments and additional clarification.

Attachments:
CustomerHistory.zip (14K)
Reasons for the class used.txt (1K) (Preview)
Posted by:
modulo51
modulo51
Rating (110): A-
Questions Asked: 1
Tutorials Posted: 353, earned $2,117.64
 

$10.00 Java, Scanner input, SortedMap<key,value>, StringTokenizer, UseNotes, consoleOutput

  • This tutorial was purchased 3 times and rated A+ by students like you.
  • Posted on Jul 30, 2009 at 01:32:58PM
A:
Preview: ... ; ");<br> try {<br> int id = Integer.parseInt(strTokz.nextToken());<br> strTokz.nextToken(); // neglect this field<br> double amount = Double.parseDouble(strTokz.nextToken());<br><br> if (sortMap.containsKey(id)) { // id is alread in map<br> sortMap.put(<br> id, sortMap.get(id) + amount);<br> System.out.println(" --- updated ---> " +<br> String.format("%6d", id) +<br> " : " +<br> String.format("%8.2f", sortMap.get(id)));<br> <br> ...

The full tutorial is about 1351 words long plus attachments.

Attachments:
CustomerHistory.java (3K) (Preview)
consoleOutput.txt (1K) (Preview)
CustomerHistoryUseNotes.txt (3K) (Preview)
CustomerHistoryZipped.zip (20K)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty