Manager.java 487 B

1234567891011121314151617181920212223242526
  1. class Manager extends Employee {
  2. private double bonus;
  3. public Manager(String name, int id, double bonus) {
  4. super(name, id);
  5. this.bonus = bonus;
  6. }
  7. // Implementación del método abstracto.
  8. public double calculateSalary() {
  9. return 50000 + bonus;
  10. }
  11. public double getBonus() {
  12. return bonus;
  13. }
  14. // Reescribe el método toString() de la clase padre.
  15. @Override
  16. public String toString() {
  17. return super.toString() +
  18. "\nBonus: $" + bonus;
  19. }
  20. }