I deleted my last post because I did'nt even ask what I wanted toask so sorry about that. Anyways, This is regarding my last Question. The assingment wants me to send data to an outputfile that looks like this:
EXample Input File:
ABC54301 TFTFTFTT TFTFTFFTTFT
Example Output File:
ABC54301 TFTFTFTTSTFTFTFFTTFT 77.5% C
X X X X X
So in My outputData Method I need to Change the Print and Println Statements so they send it it to the output file. Here is my outputData Method and Main Method
public static void outputData(String[][] studentTests, StringBuilder[][] studentResults, double[] testScores)
{
for(int rowIndex = 0; rowIndex < studentTests.length; rowIndex++)
{
for(int colIndex = 0; colIndex < studentTests[rowIndex].length; colIndex++)
{
if(colIndex == 0)
{
System.out.print(studentTests[rowIndex][colIndex] + " ");
}
else
{
System.out.println(studentTests[rowIndex][colIndex]);
}
}
for(int colIndex = 0; colIndex < studentTests[rowIndex].length; colIndex++)
{
if(colIndex == 0)
{
System.out.print(studentResults[rowIndex][colIndex] + " ");
}
else
{
System.out.println(studentResults[rowIndex][colIndex]);
}
}
}
}
Here is the Main Method
public static void main(String[] args)throws IOException
{
inFile = new Scanner(new FileReader("GradesIn.dat"));
outFile = new PrintWriter("GradesOut.dat");
String testAnswers = inFile.next();
int numberOfStudents = inFile.nextInt();
double[] testScores = new double[numberOfStudents];
String[][] studentTests = new String[numberOfStudents][2];
StringBuilder[][] studentResults = new StringBuilder[numberOfStudents][2];
initializeResults(studentResults);
getData(studentTests);
gradeTests(studentTests, studentResults, testAnswers, testScores);
outputData(studentTests, studentResults, testScores);
outFile.close();
inFile.close();
}
So if someone could help me NOT give me the code to make it where it will send the data to the output file and put the Grade Percentage and LetterGrade out to the side of the T's and F's in the output file. Thanks I am open to anything.