Q:

Java - Multilevel Inheritance

0

This Program is used to demonstrate the Multilevel Inheritance concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

class Person
{
String name;
int age;

void getdata(String a,int b)
{ 
name=a; age=b;
}
}

class Teacher extends Person
{
String qualification;
float salary;

void getqual(String s)
{
qualification =s; 
}

void getsal(float a)
{
salary=a;
}

void display()
{ 
System.out.println("\nName of Faculty = "+name);
System.out.println("\nAge of Faculty = "+age);
System.out.println("\nQualification of Faculty = "+qualification);
System.out.println("\nSalary of Faculty = "+salary); 
} 
}

class guestTeacher extends Teacher
{ 
float ppl;

void getppl(float a)
{ 
ppl=a; 
}

void display( )
{
System.out.println("\nName of Guest Lecturer = "+name);
System.out.println("\nAge of Guest Lecturere = "+age);
System.out.println("\nQualification of Guest Lecturer = "+qualification);
System.out.println("\nPayment per Lecture = "+ppl);
}
}

class multiple1
{
public static void main(String args[ ])
{
Teacher teach=new Teacher( );
teach.getdata("S.Senthilvelan",40);
teach.getqual("MCA.,M.E.,");
teach.getsal(45000);
teach.display( );

guestTeacher gteach=new guestTeacher( );
gteach.getdata("M.Sasikumar",42);
gteach.getqual("MCA.,M.E.,Ph.D.,");
gteach.getppl(2000);
gteach.display( ); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now