Intern.java 725 B

12345678910111213141516171819202122232425262728293031323334
  1. package exercise.exercise04;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title Intern
  6. * @description
  7. * @create 2026/7/24
  8. */
  9. public class Intern extends Employee{
  10. private double allowance;
  11. public Intern(int id, String name, double allowance) {
  12. super(id, name);
  13. this.allowance = allowance;
  14. }
  15. /**
  16. * 计算薪资
  17. * 返回 allowance(固定津贴,无其他扣减)
  18. * @return
  19. */
  20. @Override
  21. public double calculateSalary() {
  22. return allowance;
  23. }
  24. /**
  25. * 输出 "实习生 xxx 在学习新技能..."(xxx 为姓名)
  26. */
  27. public void learnSkill(){
  28. System.out.println("实习生 "+this.getName()+" 在学习新技能...");
  29. }
  30. }