7.
Aim: Introduction to abstract classes, abstract methods, and Interface in java
Program: Write a program to generate the resume. Create 2 Java classes Teacher (data: personal
information, qualification, experience, achievements) and Student (data: personal information, result,
discipline) which implements the java interface Resume with the method biodata().
import [Link];
interface Resume {
void bioData ( ) ; // By default it is an abstract method.
// when it is declared in an interface
}
class Teacher implements Resume {
private String Eid, name, degree, Exp, achievement;
public void getdata() {
[Link]("Enter the details of teacher");
Scanner s = new Scanner([Link]);
[Link]("Enter EID\n");
Eid = [Link]();
[Link]("Enter Name\n");
name = [Link]();
[Link]("Enter the qualification\n");
degree = [Link]();
[Link]("Enter Experience\n");
Exp = [Link]();
[Link]("Enter Achievement\n");
achievement = [Link]();
}
public void bioData ( ) {
[Link]("\n*********Resume of
Teacher**********************");
[Link]("Personal Details:\n");
[Link]("Employee id : "+Eid);
[Link]("Name : " + name);
[Link]("Qualification : " + degree);
[Link]("Experience : " +Exp);
[Link]("Achievement : "+achievement );
[Link]("*********Resume
END**********************\n");
}
}
class Student implements Resume {
private String usn, name, branch, result;
public void getdata() {
[Link]("Enter the details of students");
Scanner s = new Scanner([Link]);
[Link]("Enter Usn\n");
usn = [Link]();
[Link]("Enter Name\n");
name = [Link]();
[Link]("Enter Branch\n");
branch = [Link]();
[Link]("Enter result\n");
result = [Link]();
}
public void bioData ( ) {
[Link]("\n*********Resume of
Student**********************");
[Link]("Personal Details:\n");
[Link](" USN : "+usn);
[Link]("NAME : " + name);
[Link]("Descipline : " + branch);
[Link]("Result : " + result);
[Link]("*********Resume of END**********************\n");
}
}
class resume1
{
public static void main(String[] args) {
Teacher x = new Teacher ( ) ; // x is an instance of Teacher
Student y = new Student ( ) ; // y is an instance of Student
[Link]();
[Link] ( ); // Obtain the bio-data of a teacher X
[Link]();
[Link] (); // Obtain the bio-data of a student y
}
}
OUTPUT:
Enter the details of teacher
Enter EID
1101
Enter Name
Sachin
Enter the qualification
PhD
Enter Experience
21
Enter Achievement
GATE
*********Resume of Teacher**********************
Personal Details:
Employee id : 1101
Name : Sachin
Qualification : PhD
Experience : 21
Achievement : GATE
*********Resume END**********************
Enter the details of students
Enter Usn
4DM21AI001
Enter Name
AAdil
Enter Branch
AIML
Enter result
99
*********Resume of Student**********************
Personal Details:
USN : 4DM21AI001
NAME : AAdil
Descipline : AIML
Result : 99
*********Resume of END**********************