Advertisement
RavenSH

asd

Apr 11th, 2019
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. package employee;
  2.  
  3. public class Employee {
  4. public static long empID;
  5. public static String name;
  6.  
  7. public Employee (String name, int empID) {
  8. Employee.name = name;
  9. Employee.empID = empID;
  10.  
  11.  
  12. }
  13. public void setEmpID (int empID) {
  14. Employee.empID = empID;
  15. System.out.println(Employee.empID);
  16. }
  17. public void setName (String name) {
  18. Employee.name = name;
  19. System.out.println(Employee.name);
  20. }
  21.  
  22.  
  23. public static void main(String[] args) {
  24.  
  25. Employee empl = new Employee ("Barbara" , 102);
  26. if (name != null) {
  27. System.out.printf("Employee name is: "+name + "\n" + "Employee ID is: " + empID);
  28. }
  29. else {
  30. System.out.println("No active name");
  31. }
  32. Manager mgr = new Manager(Gosho, 123, Sopola);
  33.  
  34.  
  35. }
  36.  
  37. public static class Manager extends Employee {
  38. private String lastName;
  39.  
  40.  
  41.  
  42. public Manager(String name, int empID, String lastName) {
  43. super(name, empID);
  44. this.lastName = lastName;
  45.  
  46. if (name != null) {
  47. System.out.println("Manager lastname is: " + lastName
  48. + "\n" + "Managers ID is: " + empID
  49. + "\n" + "Managers name is: " + name);
  50. }
  51. else {
  52. System.out.println("No active name");
  53. }
  54.  
  55. }
  56.  
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement