Here is my code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args)
{
String[] name= new String[10];
int[] mark=new int[10];
int n=0;
System.out.print("#Number of students: ");
try{
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(bufferRead.readLine());
}
catch(IOException e)
{
e.printStackTrace();
}
for(int i=0;i<n;i++){
System.out.print("#The students name : ");
try{
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
name[i] = bufferRead.readLine();
}
catch(IOException e)
{
e.printStackTrace();
}
System.out.print("#Their module mark : ");
try{
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
mark[i] = Integer.parseInt(bufferRead.readLine());
}
catch(IOException e)
{
e.printStackTrace();
}
}
for(int i=0;i<n;i++){
System.out.print(name[i]+"\t");
System.out.print(mark[i]+"\t");
if (mark[i] > 35)
{
System.out.println("Pass");
}
else
{
System.out.println("Fail");
}
}
}
}
When i try to upload it onto my university system this comes up.
-#### << Differences between expected (<) your answer (>) >> ------------
1,4c1,5
< A N Other Pass
< B N Other Pass
< C N Other Fail
< D N Other Fail
---
> Exception in thread "main" java.lang.NumberFormatException: For input string: "A N Other"
> at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:492)
> at java.lang.Integer.parseInt(Integer.java:527)
> at Main.main(Main.java:13)