Vikhyath_11

3

Jul 28th, 2024
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. package employee;
  2. import java.util.*;
  3.  
  4. class EmployeeIntake {
  5. String EmpID,name;
  6. long phone,salary;
  7.  
  8. public void fetch(){
  9. Scanner sc = new Scanner(System.in);
  10. System.out.println("Enter Name: ");
  11. name=sc.nextLine();
  12. System.out.println("Enter EmpID: ");
  13. EmpID=sc.nextLine();
  14. System.out.println("Enter Phone No.: ");
  15. phone=sc.nextLong();
  16. System.out.println("Enter Salary: ");
  17. salary=sc.nextLong();
  18.  
  19. }
  20.  
  21. public void display(){
  22. System.out.println("Name : "+name);
  23. System.out.println("EmpID : "+EmpID);
  24. System.out.println("Phone No. : "+phone);
  25. System.out.println("Salary : "+salary);
  26. }
  27. }
  28.  
  29. class Teaching extends EmployeeIntake{
  30. Scanner sc = new Scanner(System.in);
  31. String domain;
  32. int publications;
  33. public void fetch(){
  34. super.fetch();
  35. System.out.println("Ente Domain");
  36. domain=sc.nextLine();
  37. System.out.println("Ente No. of Publications");
  38. publications=sc.nextInt();
  39. }
  40. public void display(){
  41. super.display();
  42. System.out.println("Domain : "+domain);
  43. System.out.println("Publications : "+publications);
  44. }
  45. }
  46.  
  47. class Technical extends EmployeeIntake{
  48. Scanner sc = new Scanner(System.in);
  49. String skill;
  50. public void fetch(){
  51. super.fetch();
  52. System.out.println("Ente Skill");
  53. skill=sc.nextLine();
  54.  
  55. }
  56. public void display(){
  57. super.display();
  58. System.out.println("Domain : "+skill);
  59.  
  60. }
  61. }
  62. class Contract extends EmployeeIntake{
  63. Scanner sc = new Scanner(System.in);
  64. int period;
  65. public void fetch(){
  66. super.fetch();
  67. System.out.println("Ente Contract Period");
  68. period=sc.nextInt();
  69.  
  70. }
  71. public void display(){
  72. super.display();
  73. System.out.println("Contract Period : "+period);
  74.  
  75. }
  76. }
  77.  
  78.  
  79. public class Employee{
  80. public static void main(String[] args) {
  81. Teaching teach = new Teaching();
  82. Technical tech = new Technical();
  83. Contract cont = new Contract();
  84.  
  85. System.out.println("Enter details of Teaching staff");
  86. teach.fetch();
  87. System.out.println("details of Teaching staff");
  88. teach.display();
  89. System.out.println("-----------------------------------------------------");
  90. System.out.println("Enter details of Technical staff");
  91. tech.fetch();
  92. System.out.println("details of Technical staff");
  93. tech.display();
  94. System.out.println("-----------------------------------------------------");
  95. System.out.println("Enter details of Contract staff");
  96. cont.fetch();
  97. System.out.println("details of Contract staff");
  98. cont.display();
  99.  
  100.  
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment