*/
العفو بس موهذا الكود اللي كتبته ماادري شفيه علق ماقااااااااااعد يطلع الكووووود بالموضوع
:mad:وللليه هذا صج معلق
import java.util.Scanner;
public class gradesofstudent {
public static void finalGrades( double course[][], double total[]){
total[5]=0.0;
System.out.println ("the total grades for each student: ");
for (int row = 0 ; row < course.length;row++){
for (int column = 0 ; row < course[row].length; column ++){
if (row == 0)
{
total [0] += course[0][column];
System.out.print("student 5: ");
System.out.print(total[0]);
}
if (row == 1)
{
total [1] += course[1][column];
System.out.print("student 2: ");
System.out.print(total[1]);
}
if (row == 2)
{
total [2] += course[2][column];
System.out.print("student 3: ");
System.out.print(total[2]);
}
if (row == 3)
{
total [3] += course[3][column];
System.out.print("student 4: ");
System.out.print(total[3]);
}
if (row == 4)
{
total [4] += course[4][column];
System.out.print("student 5: ");
System.out.print(total[4]);
}
}
}
}
public static void main(String[] args) {
double sum[] ;
sum = new double[5];
double studentGrade[][];
studentGrade = new double[5][4];
System.out.println("Enter the gradesof the 5x4 array : ");
Scanner input = new Scanner(System.in);
for (int row = 0 ; row < studentGrade.length;row++){
for (int column = 0 ; row < studentGrade[row].length; column ++)
studentGrade[row][column]= input.nextDouble();
}
gradesofstudent Garde = new gradesofstudent();
Garde . finalGrades( studentGrade , sum);
}
}
/*
Enter the gradesof the 5x4 array :
23.5 21 8.5 35.6
17.5 0 6.7 29
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at gradesofstudent.main(gradesofstudent.java:80)
*/
:wacko:سووووري إذا الكووووووووود مووااضح بس حاااولت مايطلع
