public static void ScoreDisplay(int numberOfQuestions, Calculation.OperationQuestionScore score, UserDifficulty userDifficulty, string userName) { if (File.Exists(FileUtils.GetUserFileName(userName))) { ToFile objnew = SaveToFile.DeserializeLastTest(userName); score.TotalEasyQuestion = objnew.TotalEasyQuestion; score.TotalEasyScore = objnew.TotalEasyScore; score.TotalNormalQuestion = objnew.TotalNormalQuestion; score.TotalNormalScore = objnew.TotalNormalScore; score.TotalHardQuestion = objnew.TotalHardQuestion; score.TotalHardScore = objnew.TotalHardScore; score.EasyTests = objnew.EasyTests; score.NormalTests = objnew.NormalTests; score.HardTests = objnew.HardTests; score.TwoPlayerChallengeScore = objnew.TwoPlayerChallengeScore; score.AllTimeCorrectAnswers = objnew.AllTimeCorrectAnswers; } if (userDifficulty == UserDifficulty.Easy) { Console.WriteLine($"Addition score: {score.AdditionScore} of {score.AdditionQuestion}"); Console.WriteLine($"Subtraction score: {score.SubtractionScore} of {score.SubtractionQuestion}"); Console.WriteLine($"Multiplication score: {score.MultiplicationScore} of {score.MultiplicationQuestion}"); score.EasyTests++; score.TotalEasyQuestion += numberOfQuestions; score.TotalEasyScore = Math.Round((score.TotalEasyScore + (double)(score.TotalScore / (double)numberOfQuestions) * 100) / score.EasyTests, 2); } else if (userDifficulty == UserDifficulty.Normal) { Console.WriteLine($"Addition score: {score.AdditionScore} of {score.AdditionQuestion}"); Console.WriteLine($"Subtraction score: {score.SubtractionScore} of {score.SubtractionQuestion}"); Console.WriteLine($"Multiplication score: {score.MultiplicationScore} of {score.MultiplicationQuestion}"); Console.WriteLine($"Division score: {score.DivisionScore} of {score.DivisionQuestion}"); score.NormalTests++; score.TotalNormalQuestion += numberOfQuestions; score.TotalNormalScore = Math.Round((score.TotalNormalScore + (double)(score.TotalScore / (double)numberOfQuestions) * 100) / score.NormalTests, 2); } else if (userDifficulty == UserDifficulty.Hard) { Console.WriteLine($"Multipication score: {score.MultiplicationScore} of {score.MultiplicationQuestion}"); Console.WriteLine($"Division score: {score.DivisionScore} of {score.DivisionQuestion}"); Console.WriteLine($"Power score: {score.PowerScore} of {score.PowerQuestion}"); Console.WriteLine($"Squareroot score: {score.SquareRootScore} of {score.SquareRootQuestion}"); score.HardTests++; score.TotalHardQuestion += numberOfQuestions; score.TotalHardScore = Math.Round((score.TotalHardScore + (double)(score.TotalScore / (double)numberOfQuestions) * 100) / score.HardTests, 2); } score.AllTimeCorrectAnswers += score.TotalScore; Console.WriteLine("\n"); }
public static void StatsDisplay(Calculation.OperationQuestionScore score) { string statisticsDisplay; do { Console.WriteLine("Would you like to see your all time statistics? Please type 'Y' or 'N'"); statisticsDisplay = Console.ReadLine().ToUpper(); } while (statisticsDisplay != "Y" && statisticsDisplay != "N"); if (statisticsDisplay == "Y") { Console.WriteLine($"You have answered {score.TotalEasyQuestion} easy questions so far with an average score of {score.TotalEasyScore}%"); Console.WriteLine($"You have answered {score.TotalNormalQuestion} normal questions so far with an average score of {score.TotalNormalScore}%"); Console.WriteLine($"You have answered {score.TotalHardQuestion} hard questions so far with an average score of {score.TotalHardScore}%"); Console.WriteLine($"You have won {score.TwoPlayerChallengeScore} twoPlayerChallenges"); Console.WriteLine($"You have gotten {score.AllTimeCorrectAnswers} answers correct so far!"); } }