class Total
{
int TMarks;
float Percentage;
void DisplayTotal(int x, int y)
{
TMarks = x+y;
System.out.println("Total Marks are : "+TMarks);
}
void DisplayPercentage()
{
Percentage=(float)TMarks/2000*100;
System.out.println("Percentage is : "+Percentage);
}
}
class StudentDetail
{
int Rno,Science,Social;
String SName;
Total g = new Total();
void setData(int p, String q,int r, int s)
{
Rno=p;
SName=q;
Science=r;
Social=s;
}
void ShowDetail()
{
System.out.println("Roll Number : "+Rno);
System.out.println("Students Name : "+SName);
System.out.println("Science Marks : "+Science);
System.out.println("Social Study Marks : "+Social);
g.DisplayTotal(Science, Social);
g.DisplayPercentage();
}
};
class NestedClass
{
public static void main(String args[])
{
StudentDetail SDetail = new StudentDetail();
SDetail.setData(11,"Deepak Kumar",45,85);
SDetail.ShowDetail();
}
};