I'm trying to make a program that gives marks for student.
First it should ask the student id, after that you need to give mark each of the criteria to the same student.
This code doesn't change anything after i gave the marks.
BufferedReader br = new BufferedReader(new FileReader("project.csv"));
while ((line = br.readLine()) != null) {
String[] cols = line.split(",");
System.out.println("Please choose a criteria (2-7) ?");
int subjectToGiveMark = in .nextInt(); // for creativity is 2
System.out.println("Please enter a mark :");
int mark = in .nextInt(); // which mark should be given
final int size = cols.length;
String[] finalResult = new String[size];
int index = 0;
while (index < finalResult.length) {
if (index == subjectToGiveMark) {
finalResult[index] = mark + "";
} else {
finalResult[index] = cols[index];
}
index++;
}
}
Can anyone tell me what is wrong with it ? enter image description here