public override void Visit(FullTimeEmployee employee) { int workTime = employee.WorkTime; Console.WriteLine($"正式员工 {employee.Name} 实际工作时间为:{workTime} 小时"); if (workTime > 40) { Console.WriteLine($"正式员工 {employee.Name} 加班时间为:{workTime - 40} 小时"); } else if (workTime < 40) { Console.WriteLine($"正式员工 {employee.Name} 请假时间为:{40 - workTime} 小时"); } }
public override void Visit(FullTimeEmployee employee) { int workTime = employee.WorkTime; double weekWage = employee.WeeklyWage; if (workTime > 40) { weekWage = weekWage + (workTime - 40) * 50; } else if (workTime < 40) { weekWage = weekWage - (40 - workTime) * 80; weekWage = Math.Max(weekWage, 0); } Console.WriteLine($"正式员工 {employee.Name} 实际工资为:{weekWage} 元"); }
public abstract void Visit(FullTimeEmployee employee);