Everytime I re-ask the user to enter their grades, I have it write a string to the file gradeReport, but everytime the while loop repeats, the previous result is erased. HOw do I get several lines outputted in the file?
//Open file and call writeToFile method
PrintWriter outputFile= new PrintWriter("gradeReport.txt");
outputFile.println(s.writeToFile());
outputFile.close();
And the method:
public String writeToFile()
{
DecimalFormat f = new DecimalFormat("0.00");
String str= name + "--" + id + "--" + f.format(getPercentage())+ "--" + getGrade();
return str;
}