/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.io.*;
public class MultiDimensionalArray {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
String answer;
String name[] = new String[4];
int grade[][] = new int[4][3];
double tg[] = new double[4];
do{
for(int x=0;x<name.length;x++)
{
System.out.println("Student "+(x+1));
System.out.print(" Name: ");
name[x]=br.readLine();
System.out.print(" PG : ");
grade[x][0]=Integer.parseInt(br.readLine());
System.out.print(" MG : ");
grade[x][1]=Integer.parseInt(br.readLine());
System.out.print(" FG : ");
grade[x][2]=Integer.parseInt(br.readLine());
tg[x]=grade[x][0]*.3+grade[x][1]*.3+grade[x][2]*.4;
}
System.out.println("\nSTUDENTS\tPG\tMG\tFG\tTG");
for(int x=0;x<name.length;x++)
{
System.out.print(name[x]+"\t");
for(int y=0;y<name.length-1;y++)
{
System.out.print(grade[x][y]+"\t");
}
System.out.println(tg[x]);
}
System.out.print("\nWould you like to try again? [Y/N]: ");
answer=br.readLine();
}
while(answer.equalsIgnoreCase("y"));
}
}