I want to write each elements of arrays into a text file. Eg below will demonstrate more clearly
String[] Name = {"Eric","Matt","Dave"}
Int[] Scores = {[45,56,59,74],[43,67,77,97],[56,78,98,87]}
double[] average = {45.7,77.3,67.4}
I want the following in the text file
Student Eric scored 45,56,59,74 with average of 45.7
Student Matt scored 43,67,77,97 with average of 77.3
Student Dave scored 56,78,98,87 with average of 67.4
I created output file
PrintStream output = new PrintStream(new File("output.txt"));
I used a for loop
for(int i =0;i<=Name.length;i++){
output.println("Student " + Name[i] + " scored " + Scores[i] + " with average of " + average[i]);
}
But this did not work. Please help.
Intwith uppercase is not regular java.