public override void WirteProgram(Work w) { if (w.Hour < 12) { Console.WriteLine("早上{0}点工作中", w.Hour); } else { w.SetState(new NoonState()); w.WriteProgram(); } }
public override void WirteProgram(Work w) { if (w.Hour < 17) { Console.WriteLine("中午{0}点工作中", w.Hour); } else { w.SetState(new EveningState()); w.WriteProgram(); } }
public override void WirteProgram(Work w) { if (!w.Finsh) { Console.WriteLine("晚上{0}点加班中", w.Hour); } else { w.SetState(new SleepingState()); w.WriteProgram(); } }