VBA Project #4 30 Points Write the code to play a number guessing game in Excel. The game is the old favorite that starts with a prompt like "I am thinking of a number between 0 and 20". And then you...

have to use Mircosoft EXCEL VBA FOR THIS


VBA Project #4 30 Points Write the code to play a number guessing game in Excel. The game is the old favorite that starts with a prompt like "I am thinking of a number between 0 and 20". And then you define how many guesses the guesser gets – they guess and you respond with answers like: "too high", "too low", "correct!". But, if the guesses uses up his/her guesses – they lose. Create a "form-like" input area on a Worksheet on which the user will input the game parameters and see the game results. Consider these elements: • Allow the user to enter the range of numbers for the guessing game: lower and upper numbers from which the secret number will be selected (the portion to handle the "I'm thinking of a number between"). • Let the user input the number of guesses they think they need to guess the secret number. • These inputs should be entered directly on the worksheet by the person playing the game. You can prepopulate those cells with default values – like Low = 0, High = 20, Number of Guesses = 5 as that may save the game player some keystrokes! But, do not use an Inputbox to capture this input! • Add a properly labeled button to the worksheet that will start the game play. • Consider the best way to provide the response to each guess. Things you may want to include are: o Guess count, for example Guess 3 of 5 o The value guesses by the user o The response to the guess: "too high", "too low", "correct!" • If the User runs out of guesses tell him/her. Provide some message to communicate that the game is over and that they are out of guesses. • If the User guesses the secret number – output some congratulatory remark. (Better solutions could provide a few different remarks randomly – but this would be extra credit to figure that out – so don't make yourself crazy in that attempt.) Your form needs to have a good UI and provide a great UX! It must be intuitive and easy to play! As much as is possible, elect to use the Excel worksheet for most inputs and outputs – to save the user from having to answer a lot of message boxes (and in case they can't remember their guesses and it's response). In terms of operation – play the game with someone – just using paper. Make note of the interactions and the order of them. In your solution, the user will enter their inputs on your Excel "form" and click the button to start the game. Your VBA code will need to generate a Random Number between the span of values provided by the user. A new random number should be generated each time the user plays the VBA Project #4 30 Points game – otherwise your game is only fun to play one time. Use the WorksheetFunction object to access the Excel RandBetween() function to generate your random number. Do not show the generated number to the user. Use a loop that will provide the correct number of iterations, based upon the user's requested number of guesses. Inside the loop, use an input box to prompt the user to enter his/her guess. Evaluate the guess and provide an appropriate message in response to the guess in a designated output area so users can see what they have guessed and the program's response. If the user guesses the number within the allotted guesses – stop the game and tell the user how many guesses it took to guess the correct answer. If the user fails to guess the number because they run out of attempts, provide an appropriate response to that as well. The user may want to play the game more than once, thus, your VBA code should clear the game output area at the start of each new game. Do not clear the input area – since the user may want to play using the same game parameters. Grading Rubric: • 13 Points for Worksheet Game Board design: easy to understand, well formatted & logical arrangement • 13 Points for a Correct Solution in Excel – that works as described: all required elements for processing multiple game attempts • 4 Points for well written code that follows good programming techniques of variable declaration, comments, indentation for visual cues regarding logical constructs, etc. Submit your Excel [macro-enabled] document to Blackboard by the assignment due date. Be sure to SAVE your Excel document BEFORE submitting it to Blackboard – as failure to SAVE will submit a document without the VBA code. And, as usual, please remember that late work is not accepted. Ready for a challenge? Time on your hands and you want to try an Extra Credit Opportunity? Create a variation in which you will play the game with words. (This will definitely take a new worksheet – with a different user interface. Explain the rules and provide for any inputs needed to play the game). Since you can't randomly create a word, manually create a word bank by adding a hidden worksheet that lists 10 – 20 words in Column A, make up a hint about the Word in Column B, provide a synonym (a word that means the same thing) in Column C and an antonym (something that means the opposite) in Column D. Use column E to place a value in the row to track if the word has been used in the round. Ask the user how many words they want to guess (where each word is a round) – and tell them they have up to 3 guesses for each word. VBA Project #4 30 Points So play may work like this. I say I want to play 2 rounds. Round 1 – tells me -- HINT: an emotion, I guess "Anger" Synonym: Glee, I guess "Elation" Antonym: Sad, I guess "Happy" "You Win Round 1! – Good Job" Round 2 – tells me -- HINT: describing someone who is ready to attack, I guess "criminal" Synonym: hostile, I guess "felon" Antonym: passive, I guess "fighter" "You lose! The word was Aggressive" You won 1 of 2 Rounds! VBA Project #4 30 Points For each round -- Select the word to guess using a variable assigned with a random value – that will point to the row of the word to be used. If the word has been used previously (Column E) – generate another random value (and do this iteratively until a word is found). Mark the row as used – and then give the user a hint about the word – and let them guess. If they guess correctly, score the round and proceed to the next word. If they guess incorrectly, give them the synonym – and let them guess. If they guess correctly, score the round and proceed to the next word – otherwise give them the antonym and let them guess. If they guess correctly, score the round – otherwise tell the user that they ran out of guesses in that round and end that round. (the number of rounds you play corresponds to the number of word the user wants to guess). Scoring is as follows: 1 guess = 3 points, 2 guesses = 2 points, 3 guesses = 1 point – otherwise failure to guess the word = 0 points are earned. Accumulate the total points for all rounds. Also accumulate the total points possible for all rounds ( # of rounds * 3). After the user has played all the rounds – pop up a message box with his/her total score and a Rating of the user's skills. Use a simple percentage correct – and provide the Rating based upon this table: 90 - 100% = Rating of Champion 75 – 90% = Rating of Skilled 40 – 75% = Rating of Novice Less than 40% = Rating of Flunky! You have some latitude in how you play the game. I have not coded this game, so if you find that my ideas don't work fully – create a solution that does. Grading Rubric: Submit your Excel [macro-enabled] document to Blackboard by the assignment due date. Be sure to SAVE your Excel document BEFORE submitting it to Blackboard – as failure to SAVE will submit a document without the VBA code. And, as usual, please remembe...
Apr 07, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here