Adding sorted data to info string.

[code]if (event.getActionCommand()=="Write")
//assign empty value to info string variable
writeFile = "";
//start try block
// Set up the output file stream
PrintWriter outFile = new PrintWriter(new PrintStream(new File("GradeReport.txt")));
// Print a header to the output file
outFile.printf("Student Test1 Test2 Test3 Test4 Test5 Average Grade%n");
// for each value in the gradeList arraylist, add the sorted student data (first name, last name, grade) to the info string variable with separated value.
for(int c = 0; c < 15; c++)
outFile.printf("%s%t", gradeList.add(fname);
for(int s = 0; s < 5; s++)
outFile.printf("%5d%t", gradeList.add(assn);
outFile.printf("%7.2f%t", gradeList.add(avg);
outFile.printf("%5c%n", gradeList.add(grade);

I'm pretty sure I'm not even close but I am getting add errors in the add method.


  • In your code there seem to be methods which you did not show how they work, but to make it easier for me to help;
    Can you briefly explain what you want to achieve; i.e. describe the format of the inputs required by your program and also describe the desired output. Just make a description in words. This will make it easier to forward a working example.
  • Ooopps! I'm sorry.

    Here is the instructions.

    Write a GUI application that will read student scores, calculate student grade, sort student data, and write output into a text file. Application should provide an option for user to upload a text file containing student course data such as first name, last name, and five assignment scores. Program will ask user to browse and select a file. Program should then determine each student grade (see below for grade scale). Application should provide an option to sort the student data including their grade based on their last name. Application should provide an option to produce an output text file, named as
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!