@@ -8,24 +8,24 @@ public static void gameLogic() {
88 Scanner sc = new Scanner (System .in );
99 Engine .userGreetings ();
1010 System .out .println ("Answer 'yes' if the number is even, otherwise answer 'no'." );
11- while (Engine .questionCounter != Engine .MAX_QUESTIONS ) {
11+ while (Engine .getQuestionCounter () != Engine .getMaxQuestions () ) {
1212 Random rand = new Random ();
1313 int randNum = rand .nextInt (rndMax );
1414 System .out .println ("Question: " + randNum );
1515 System .out .print ("Your answer: " );
1616 String answer = sc .next ();
1717 if (randNum % 2 == 0 && answer .equals ("yes" )) {
18- System .out .println ("Correct! " + Engine .userName + "\n " );
19- Engine .questionCounter ++ ;
18+ System .out .println ("Correct! " + Engine .getUserName () + "\n " );
19+ Engine .incrementQuestionsCounter () ;
2020 } else if (randNum % 2 != 0 && answer .equals ("no" )) {
2121 System .out .println ("Correct!\n " );
22- Engine .questionCounter ++ ;
22+ Engine .incrementQuestionsCounter () ;
2323 } else {
24- System .out .println ("Let's try again, " + Engine .userName + "!" );
24+ System .out .println ("Let's try again, " + Engine .getUserName () + "!" );
2525 break ;
2626 }
27- if (Engine .questionCounter == Engine .MAX_QUESTIONS ) {
28- System .out .println ("Congratulations, " + Engine .userName + "!" );
27+ if (Engine .getQuestionCounter () == Engine .getMaxQuestions () ) {
28+ System .out .println ("Congratulations, " + Engine .getUserName () + "!" );
2929 }
3030 }
3131 }
0 commit comments