Пример #1
0
        private static void Run()
        {
            var student = new EslStudent(); // Default Level1State

            student.TakeTest(70, 60, 60);   // Level up to Level2State
            student.TakeTest(80, 80, 80);   // Level up to Level3State
            student.TakeTest(85, 85, 90);   // Level up to Level4State
            student.TakeTest(90, 90, 90);   // Level up to GraduationState
        }
Пример #2
0
 public override void UpdateStateByScores(EslStudent eslStudent, float readingScore, float writingScore, float speakingScore)
 {
     if (IsGraduationQualified(readingScore, writingScore, speakingScore))
     {
         eslStudent.EslState = new GraduationState();
         Console.WriteLine($"You passed the test! {nameof(Level4State)} => {nameof(GraduationState)}");
     }
     else
     {
         Console.WriteLine("You Failed the test!");
     }
 }
Пример #3
0
 public override void UpdateStateByScores(EslStudent eslStudent, float readingScore, float writingScore, float speakingScore)
 {
     throw new InvalidOperationException("You already graduated ESL course.");
 }
Пример #4
0
 public abstract void UpdateStateByScores(EslStudent eslStudent, float readingScore, float writingScore, float speakingScore);