
import javax.swing.*;

public class prog {

    public static void main(String[] args) {
        int grades[][] = new int[3][4];
        int clock[][] = new int[3][4];
        int sum = 0, j, i;
        String output;
        for (i = 0; i < 3; i++) {
            for (j = 0; j < 4; j++) {
                grades[i][j] = Integer.parseInt(JOptionPane.showInputDialog("Enter grades of student(" + (i + 1) + ") :: grade(" + (j + 1) + ")"));
                clock[i][j] = Integer.parseInt(JOptionPane.showInputDialog("Enter clock of stuent(" + (i + 1) + ") :: clock(" + (j + 1) + ")"));
            }
        }
        for (i = 0; i < 3; i++) {
            for (j = 0; j < 4; j++) {
                sum += grades[i][j] * clock[i][j];
            }
            output = "The Average of  four grades for student (" + (i + 1) + ")= " + (sum / 4);
            JOptionPane.showMessageDialog(null, output);
        }
    }
}
