Tuesday, March 23, 2010

Student Report

import java.io.*;

public class question6
{
  public static void main(String args[]) throws IOException
  { question6 abc = new question6();
  abc.show();
  }
   
  void show() throws IOException
  { InputStreamReader read = new InputStreamReader(System.in);
  BufferedReader br = new BufferedReader(read);
  String name[] = new String[2];
  int math[] = new int[2];
  int comp[] = new int[2];
  int english[] = new int[2];
  int total[] = new int[2];
  int percent[] = new int[2];
  for(int i=0;i<2;i++)
  { System.out.println("Enter name of student");
  name[i] = br.readLine();
  System.out.println("Enter his marks in maths");
  math[i]=Integer.parseInt(br.readLine());
  System.out.println("Enter his marks in english");
  english[i]=Integer.parseInt(br.readLine());
  System.out.println("Enter his marks in computers");
  comp[i]=Integer.parseInt(br.readLine());
  }
  for(int i=0;i<2;i++)
  { total[i] = math[i]+english[i]+comp[i];
  percent[i] = total[i]/3;
  }
  System.out.println(" *****Student Report*******\n");
  System.out.println(" name english math computers total percentage");
  for(int i=0;i<2;i++)
  { System.out.println(name[i]+ " " +english[i]+ " " +math[i]+" " +comp[i]+" " +total[i]+ " " +percent[i]+"%");
  } 
  }
}
   

No comments:

Post a Comment