Sunday 19 May 2013

Find Percentage Using BlueJ (Helpful for Examination)

import java.io.*;
class percentage
{
public static void main(String args)throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int sc,sc1,mth,mth1,sosc,sosc1,hin,hin1,comp,comp1,eng,eng1,total_marks,full_marks;
double per;
System.out.println("Enter SCIENCE total marks & full marks");
sc=Integer.parseInt(in.readLine());
sc1=Integer.parseInt(in.readLine());
System.out.println("Enter MATHS total marks & full marks");
mth=Integer.parseInt(in.readLine());
mth1=Integer.parseInt(in.readLine());
System.out.println("Enter SOCIAL SCIENCE (History-Civics & Geography) total marks & full marks");
sosc=Integer.parseInt(in.readLine());
sosc1=Integer.parseInt(in.readLine());
System.out.println("Enter HINDI total marks & full marks");
hin=Integer.parseInt(in.readLine());
hin1=Integer.parseInt(in.readLine());
System.out.println("Enter COMPUTER total marks & full marks");
comp=Integer.parseInt(in.readLine());
comp1=Integer.parseInt(in.readLine());
System.out.println("Enter ENGLISH total marks & full marks");
eng=Integer.parseInt(in.readLine());
eng1=Integer.parseInt(in.readLine());
total_marks=sc+mth+sosc+hin+comp+eng;
full_marks=sc1+mth1+sosc1+hin1+comp1+eng1;
per=(total_marks/full_marks)*100;
System.out.println("Percentage="+per);
{
if(per>=60)
System.out.println("1st DIVISION");
else
if(per<=60&&per>=40)
System.out.println("2nd DIVISION");
else
System.out.println("3rd DIVISION");
}
}
}




NOTE:- You can run this void by inserting this code "{}" within quotes