CS1336 Assignment 5

Due November 30, 2009

This program is an exercise in using arrays.  Do the following steps:

1. Create a text file named CS1336Asg5data.txt (using Notepad or another text editor) with at least 10 lines that contain a last name, a comma, and a double-precision number, like this:
Cole,11371.50
Andrews,22731.40

Please include the data file with your submission so the TA can run your program. Your program should find the file in the same folder from which it runs.

2. Read each line and put the name into an array of strings and the number into an array of doubles. 

3. Sort the array of names.

4. Sum the array of doubles and display the sum.

5. Print the sorted list of names and the associated number next to it, in columns.  This means you will have to keep track of which name and number go together.  Thus for the above input, you would print:
Andrews      22731.40
Cole         11371.50

6. Programming hint: You might want to keep other information in the array of names that you don't print.

To hand in: Submit your Java source code (.java file(s) on e_learning.  Your files should be named <Last Name>Asg5.  For example, if I were submitting it, I would use the name ColeAsg5.  Grades and comments will be posted online.  Your program must have the following in the comments at the top of the first page:

  • Your name, class (CS1336) and e-mail address.
  • The assignment number.
  • The date you handed it in.

NOTE: LATE HOMEWORK WILL NOT BE ACCEPTED AND WILL BE RECORDED AS A ZERO.  GET AN EARLY START.