I have 2 tables, the first one displays the name of the student, and the second one displays the marks for the student. each student has 2 semesters. I wrote it like this:
import java.util.Scanner;
public class Main
{
public static void main (String args[])
{
Scanner Sc=new Scanner(System.in);
int Number,i,j,q,n;
System.out.println(" how many student in your group ?");
Number=Sc.nextInt();
//create the Array
String [] tab =new String [Number];
for(n=0;n<Number;n++)
{
System.out.println(" Enter studnt name : "+(n + 1) );
tab[n]=Sc.nextLine();
}
int [][] marks=new int [2][Number];
for(j=0;j<Number;j++)
{
for (i=0;i<1;i++)
{
System.out.println(" Enter the marks of the first semster : "+(j + 1));
marks [i][j]=Sc.nextInt();
}
for (q=1;q<2;q++)
{
System.out.println(" Enter the marks of the Second semseter : "+(j + 1));
marks [q][j]=Sc.nextInt();
}
}
}
}
i
= for the first rows which will display the marks for the first semester for each student
q
= for the second rows which will display the marks for the second semester for each student
Now I want to find the total marks for each student and the highest marks. ( highest marks for one student mean he/she gets the highest marks in which semester and the total also for the one student total = first semester + second semester). But I don't know how I will write it if anyone can help me I would be grateful to him.