class Student
{
int p,c,m,rn, total;
double per;
void getValues(int aa, int bb, int cc, int dd)
{
rn = aa;
p = bb;
c = cc;
m = dd;
}
void percentage()
{
total = p+c+m;
per = total/(double)300*100;
}
void showResult()
{
percentage();
System.out.println(rn+" "+per);
}
public static void main(String[] args) {
Student rohit = new Student();
rohit.getValues(101,50,65,85);
rohit.showResult();
}
}
OUTPUT
Comments
Post a Comment