this is an example of the file:
Caldwell E.,CSC,25,5,500.00,250.00,100.00,20.00,1000.00
there are 18 of these entries in the file consists of : last name and first initial,department,miles walked,number of pledges, and the pledge amounts.
I have to :
1. display the file content
2.compute the total pledges obtained by each person
3.display a list of names and there total pledge amounts sorted by total pledge amount.
4.display the following by department
a. Total participants
b.total amount of pledges in $
this is the code i have so far:
/**
* This program reads a text file line by line and print to the console. It uses
* FileOutputStream to read the file.
*
*/
public class FileInput
{
public static void main(String[] args) throws IOException
{
File file = new File("README.txt");
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
try {
fis = new FileInputStream(file);
// Here BufferedInputStream is added for fast reading.
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
// dis.available() returns 0 if the file does not have more lines.
while (dis.available() != 0) {
// this statement reads the line from the file and print it to
// the console.
System.out.println(dis.readLine());
}
// dispose all the resources after using them.
fis.close();
bis.close();
dis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
someone please help me if you can!!!!!!!