[go: up one dir, main page]

0% found this document useful (0 votes)
55 views4 pages

Code Name Input: Import Class Protected Int Protected New Void

This document defines classes for staff, education, teacher, typist, officer, regular, and casual employees. The staff and education classes are extended by the other classes to inherit common properties like code and name. Each class has get and display methods to collect and output the employee details specific to that type, such as subject taught for teachers or wage rate for casual employees. The main method creates instances of the teacher, typist, and officer classes and calls their get and display methods to demonstrate collecting and viewing the employee information.

Uploaded by

Sumit Agrawal
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)
55 views4 pages

Code Name Input: Import Class Protected Int Protected New Void

This document defines classes for staff, education, teacher, typist, officer, regular, and casual employees. The staff and education classes are extended by the other classes to inherit common properties like code and name. Each class has get and display methods to collect and output the employee details specific to that type, such as subject taught for teachers or wage rate for casual employees. The main method creates instances of the teacher, typist, and officer classes and calls their get and display methods to demonstrate collecting and viewing the employee information.

Uploaded by

Sumit Agrawal
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/ 4

import java.util.

Scanner;

class Staff
{
protected int code;
protected String name;

Scanner input=new Scanner(System.in);


void getStaff()
{
System.out.println("Enter Code");
code=input.nextInt();

System.out.println("Enter Name");
name=input.next();

void displayStaff()
{
System.out.println("Code is"+code);
System.out.println("Name is"+name);

}
class EducationInfo extends Staff
{
protected String highQuali, highProQuali;

void getEducationInfo()
{
getStaff();

System.out.println("Enter Your Highest Qualification in General


Education");
highQuali=input.next();

System.out.println("Enter Your Highest Professional


Qualification");
highProQuali=input.next();
}
void displayEducationInfo()
{
displayStaff();

System.out.println("Highest Qualification in General


Education:"+highQuali);

System.out.println("Highest Professional
Qualification:"+highProQuali);

}
}

class Teacher extends EducationInfo


{
private String subject, publication;

void getTeacher()
{
getEducationInfo();

System.out.println("Enter Subject");
subject=input.next();

System.out.println("Enter Publication");
publication=input.next();

void displayTeacher()
{
displayEducationInfo();

System.out.println("Subject:"+subject);
System.out.println("Publication:"+publication);

class Typist extends Staff


{
private int speed;

void getTypist()
{
getStaff();

System.out.println("Enter Speed");
speed=input.nextInt();

void displayTypist()
{
displayStaff();

System.out.println("Speed:"+speed);
}

}
class Officer extends EducationInfo
{
private String grade;

void getOfficer()
{
getEducationInfo();

System.out.println("Enter Grade");
grade=input.next();

void displayOfficer()
{
displayEducationInfo();

System.out.println("Grade:"+grade);

class Regular extends Typist


{

class Casual extends Typist


{
private int wages;

void getCasual()
{
getTypist();
System.out.println("Enter Wages");
wages=input.nextInt();

void displayCasual()
{
displayTypist();
System.out.println("Wages"+wages);
}

public class EditEdu {

public static void main(String[] args) {


// TODO Auto-generated method stub
Teacher teach=new Teacher();
Typist type=new Typist();
Officer Off=new Officer();

teach.getTeacher();
teach.displayTeacher();

type.getTypist();
type.displayTypist();

Off.getOfficer();
Off.displayOfficer();

You might also like