Write the code to play a number guessing game

Assignment Help Visual Basic Programming
Reference no: EM132840712

VBA Project

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 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.

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.

Attachment:- VBA Project.rar

Reference no: EM132840712

Questions Cloud

Difference between verbal and nonverbal communication : Explain the difference between verbal and nonverbal communication list positive and negative for both
Assignment on tesco cooks the books : As of 2014, British supermarket chain Tesco held approximately 29 percent of Britain's grocery market, with more than 3,500 stores and over 310,000 employees.
Money demand and supply in pakistan economy : Analyze the condition of money demand and supply in Pakistan's economy. Compare the money situation of Pakistan with Indian and USA money market.
What the consolidated share capital amount of berry emily : What the consolidated share capital amount of the Berry Emily Georgia group is? Berry Limited owns 100% of the shares in both entities.
Write the code to play a number guessing game : Write the code to play a number guessing game in Excel. The game is the old favorite that starts with a prompt
What is the cause of the chief complaint : Consider what is the cause of the chief complaint, the treatments that should be prescribed, what counseling points to provide the patient, and her history.
Discuss the issue of waste in fast-fashion : Discuss the issue of waste in fast-fashion and its effect on environment and economy
What are some challenges of risk and quality management : What are some challenges of risk and quality management? Explain In healthcare , please add reference as well
Discuss the main issues that led Genesis Health and Fitness : The culture of Genesis Health & Fitness encouraged high risk taking. Discuss the main issues that led Genesis Health & Fitness to fail

Reviews

Write a Review

Visual Basic Programming Questions & Answers

  Designing vb applications across multiple platforms

Technical Project "Designing VB Applications Across Multiple Platforms". This assignment will contain two (2) Parts: Written Paper and Visual Basic Prototype. The Visual Basic Prototype is not included in the total page count but is included in the e..

  Visual basic programming discussion

The use of decision logic is one of the major concepts of computer programming. The decision takes your code from being sequential to one that can take various options based on the different conditions. Determine the method of coding that you would u..

  Ticketseller

Use Visual basic 2010Visual Basic,  TicketSeller. This assignment will contain two (2) Parts: Event Planning Document and Coding phase. You must submit both parts as separate files for the completion of this assignment. Remember, you are only to de..

  Data storage & "exception error trapping"

Discussion on Data Storage and  "Exception Error Trapping".

  Designing vb applications across multiple platforms

Technical Project "Designing VB Applications Across Multiple Platforms".

  The implementation of server side of the application

Implementation of dynamic content, server side (backend) and database for your web site using Microsoft Visual Studio 2012

  Need help building a vwd website

Need help building a VWD website. This website may not go live. I have little progress as a family tragedy has impeded my time for school.

  To develop a visual basic console application

The aim of the assessment is to develop a Visual Basic console application that performs a number of mathematical functions. The mathematics package will be menu driven, i.e. a number of options will be displayed, and the user will be able to input w..

  Program in basic which prompts user to input two integers

Write down the program by using Small Basic which prompts the user to input two integers: firstNum and secondNum (firstNum must be less than secondNum).

  Develop vb-net application that includes arrays and loops

Develop a VB.NET application that includes arrays, loops, and IF statements to do the following. Your output must also display the number of applicant(s) being interviewed.

  Visual basic program to accept numeral values

Write a VISUAL BASIC program to accept numeral values of any unit, sum up the total, calculate the average, and then Output the result with a proper unit.

  Write a visual logic program to accept series of number

Write a Visual Logic program which accepts a series of numbers, until the first negative value is entered. The maximum number of non-negative input values is 250.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd