Showing posts with label student result. Show all posts
Showing posts with label student result. Show all posts

Write a program to read the data and determine the following (a)Total marks obtained by each student.(b)The highest marks in each subject and the roll no.of the student who secured it(c)the student obtained the highest total marks

import java.io.*;
class StudentResult
{

int result[][]=new int[100][5];
int i,j,k,total,maxr,maxm;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void takeData() throws IOException
{
for(i=0;i< 100;i++)
{
total=0; for(j=0;j< 4;j++)
{
if(j==0)
System.out.println("Enter Roll number\t");
else if(j==1)
System.out.println ("Enter 1st subject marks\t");
else if(j==2)
System.out.println ("Enter 2nd subject marks\t");
else if(j==3)
System.out.println ("Enter 3rd subject marks\t");
result[i][j]=Integer.parseInt(br.readLine());
if(j!=0) total+=result[i][j];
}
result[i][j]=total;
}
}
public void showResult()
{
System.out.println ("Mark sheet");
System.out.println ("\nRoll 1st 2nd 3rd Total");
for(i=0;i<100;i++)
{
for(j=0;j< 5;j++)
{
System.out.println (" "+result[i][j]);
}
System.out.println ();
}
System.out.println ("\n\n");
System.out.println ("Roll number with total");
System.out.println("\nRoll Total");
for(i=0;i<100;i++)
{
for(j=0;j<5;j++)
{
if((j==0)||(j==4))
System.out.println (" "+result[i][j]);
}
System.out.println ();
}
for(i=1;i< 4;i++)
{
for(j=0;j< 100;j++)
{
if(j==0)
{
maxm=result[j][i]; maxr=result[j][0];
}
else if(result[j][i]>maxm)
{
maxm=result[j][i];
maxr=result[j][0];
}
}
if(i==1)
System.out.println ("\nMaximum marks in sub1 is :"+maxm + ""+maxr);
else if(i==2)
System.out.println ("\nMaximum marks in sub2 is :"+maxm + " "+maxr);
else if(i==3)
System.out.println ("\nMaximum marks in sub3 is :"+maxm + " "+maxr);
}
for(i=0;i< 100;i++)
{
for(j=0;j< 5;j++)
{
if(j==4)
{
if(i==0)
{
maxm=result[i][j]; maxr=result[i][0];
}
else if(result[i][j]>maxm)
{
maxm=result[i][j];
maxr=result[i][0];
}
}
}
}
System.out.println ("\nMaximum total is :"+maxm + " "+maxr);
}
}