banaandrew

Employee Problem

Jul 24th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public class Commission extends Employee {
  2.  
  3. @Override
  4. void calcSalary() {
  5.  
  6. }
  7.  
  8. }
  9.  
  10. public abstract class Employee {
  11.  
  12. String stringVar;
  13. int intVar;
  14.  
  15. abstract void calcSalary();
  16. }
  17.  
  18. public class Hourly extends Employee {
  19.  
  20. @Override
  21. void calcSalary() {
  22.  
  23. }
  24.  
  25. }
  26.  
  27. public class Main {
  28.  
  29. public static void main(String[] args) {
  30. Employee[] employee = new Employee[4];
  31.  
  32. employee[0] = new Commission();
  33. employee[1] = new Commission();
  34. employee[2] = new Hourly();
  35. employee[3] = new Hourly();
  36.  
  37. for(Employee current: employee) {
  38. current.calcSalary();
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment