0% found this document useful (0 votes)
290 views

7 Java Lab

The document describes a program to generate resumes for teachers and students by creating Teacher and Student classes that implement the Resume interface with a bioData method. The main method creates instances of Teacher and Student, calls their getdata methods to collect user input, and then calls bioData to output their resume details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
290 views

7 Java Lab

The document describes a program to generate resumes for teachers and students by creating Teacher and Student classes that implement the Resume interface with a bioData method. The main method creates instances of Teacher and Student, calls their getdata methods to collect user input, and then calls bioData to output their resume details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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 java.util.Scanner;

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() {


System.out.println("Enter the details of teacher");
Scanner s = new Scanner(System.in);

System.out.println("Enter EID\n");
Eid = s.next();

System.out.println("Enter Name\n");
name = s.next();

System.out.println("Enter the qualification\n");


degree = s.next();

System.out.println("Enter Experience\n");
Exp = s.next();
System.out.println("Enter Achievement\n");
achievement = s.next();
}

public void bioData ( ) {


System.out.println("\n*********Resume of
Teacher**********************");
System.out.println("Personal Details:\n");
System.out.println("Employee id : "+Eid);
System.out.println("Name : " + name);
System.out.println("Qualification : " + degree);
System.out.println("Experience : " +Exp);
System.out.println("Achievement : "+achievement );
System.out.println("*********Resume
END**********************\n");
}
}
class Student implements Resume {
private String usn, name, branch, result;

public void getdata() {


System.out.println("Enter the details of students");
Scanner s = new Scanner(System.in);

System.out.println("Enter Usn\n");
usn = s.next();

System.out.println("Enter Name\n");
name = s.next();

System.out.println("Enter Branch\n");
branch = s.next();

System.out.println("Enter result\n");
result = s.next();
}

public void bioData ( ) {


System.out.println("\n*********Resume of
Student**********************");
System.out.println("Personal Details:\n");
System.out.println(" USN : "+usn);
System.out.println("NAME : " + name);
System.out.println("Descipline : " + branch);
System.out.println("Result : " + result);
System.out.println("*********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

x.getdata();
x.bioData ( ); // Obtain the bio-data of a teacher X

y.getdata();
y.bioData (); // 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**********************

You might also like