Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package employee;
- import java.util.*;
- class EmployeeIntake {
- String EmpID,name;
- long phone,salary;
- public void fetch(){
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter Name: ");
- name=sc.nextLine();
- System.out.println("Enter EmpID: ");
- EmpID=sc.nextLine();
- System.out.println("Enter Phone No.: ");
- phone=sc.nextLong();
- System.out.println("Enter Salary: ");
- salary=sc.nextLong();
- }
- public void display(){
- System.out.println("Name : "+name);
- System.out.println("EmpID : "+EmpID);
- System.out.println("Phone No. : "+phone);
- System.out.println("Salary : "+salary);
- }
- }
- class Teaching extends EmployeeIntake{
- Scanner sc = new Scanner(System.in);
- String domain;
- int publications;
- public void fetch(){
- super.fetch();
- System.out.println("Ente Domain");
- domain=sc.nextLine();
- System.out.println("Ente No. of Publications");
- publications=sc.nextInt();
- }
- public void display(){
- super.display();
- System.out.println("Domain : "+domain);
- System.out.println("Publications : "+publications);
- }
- }
- class Technical extends EmployeeIntake{
- Scanner sc = new Scanner(System.in);
- String skill;
- public void fetch(){
- super.fetch();
- System.out.println("Ente Skill");
- skill=sc.nextLine();
- }
- public void display(){
- super.display();
- System.out.println("Domain : "+skill);
- }
- }
- class Contract extends EmployeeIntake{
- Scanner sc = new Scanner(System.in);
- int period;
- public void fetch(){
- super.fetch();
- System.out.println("Ente Contract Period");
- period=sc.nextInt();
- }
- public void display(){
- super.display();
- System.out.println("Contract Period : "+period);
- }
- }
- public class Employee{
- public static void main(String[] args) {
- Teaching teach = new Teaching();
- Technical tech = new Technical();
- Contract cont = new Contract();
- System.out.println("Enter details of Teaching staff");
- teach.fetch();
- System.out.println("details of Teaching staff");
- teach.display();
- System.out.println("-----------------------------------------------------");
- System.out.println("Enter details of Technical staff");
- tech.fetch();
- System.out.println("details of Technical staff");
- tech.display();
- System.out.println("-----------------------------------------------------");
- System.out.println("Enter details of Contract staff");
- cont.fetch();
- System.out.println("details of Contract staff");
- cont.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment