Hello I need help for this homework by using C language The

Hello, I need help for this homework by using C# language :

The goal of this project is to create a guessing game. Break the project into appropriate methods.

The game should generate a random number between 1 and 500.

The player gets 10 tries to guess the number. With each guess the game will notify the player whether the guess is too high, too low or correct.

If the player correctly guesses the number, the program will stop asking for guesses, congratulate the player and show the player\'s score. The score is 10 minus the number of guesses.

Use proper naming conventions and document code.

____

When the game ends prompt whether the player wants to play again. If the player responds yes, start the play over, if no, end the game and display all the players scores and their average scores.

Use an array to track scores for the games played.

General suggestions: break the game into discrete parts. Test each part and make sure it is working before going on the next part. Draw a picture if you need to, write out a list of the steps in the game.

Solution

Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Midterm1
{
  
    class Program
    {
        int number;
        //Steps:
        // 1) Generate random number between 1 & 500;
        // 2) User input (guess);
        // 3) Selection: too high, too low, or correct;
        // 4) Ten tries to guess number (loops);
        // 5) Calculate score (array);
        // 6) End, or start over (loop)
        static void Main(string[] args)
        {
         Program p = new Program();
         p.GetRandom();
         p.StartGame();
        }

        private void GetRandom()
        {
            Random rand = new Random();
            number = rand.Next(1, 501);
        }

        private void StartGame()
        {
            int Score = 10;
            for (int i = 0; i < 10; i++)
            {

                Console.WriteLine(\"Guess a number between 1 and 500\");
                int Guess = int.Parse(Console.ReadLine());
                if (Guess > number)
                {
                    Console.WriteLine(\"Your guess was too high\");
                }
                else if (Guess < number)
                {
                    Console.WriteLine(\"Your guess was too low\");
                }
                else
                {
                    Console.WriteLine(\"Congratulations! You guessed the number.\");
                    break;
                }
                Score--;
            }
            string go = \"yes\";
            int counter = 0;
            while (go.Equals(\"yes\") || go.Equals(\"Yes\"))
            {
                counter++;
                Console.WriteLine(\"You have done {0} loops\", counter);
                Console.WriteLine(\"Do you want to do another: Yes or no?\");
                go = Console.ReadLine();
            }
         
            Console.WriteLine(\"Your score is {0}\", Score);
            Console.ReadKey();
        }
        private void CalculateScore()
        {
            int[] totalScore = new int[10];

        }
    }
}

Hello, I need help for this homework by using C# language : The goal of this project is to create a guessing game. Break the project into appropriate methods. T
Hello, I need help for this homework by using C# language : The goal of this project is to create a guessing game. Break the project into appropriate methods. T

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site