Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will transform the program that was written to play a letter guessing game (Project 1) to a function- based program. General Requirements for project

image text in transcribed
You will transform the program that was written to play a letter guessing game (Project 1) to a function- based program. General Requirements for project 2 Rewrite the program from project 1 using at least four programmer-defined functions other than the main function. .All functions (except the main function) will be defined as follows: The function prototype appears before the main Comment describing what the function does appears directly under function prototype Formal variabl The functions definition appears after the main o o o o e name s are not used in any prototype .The first function's name is introduction, which will print (show on the screen) Welcome to the Letter Guessing Game You will enter the number of games you want to play (a-4 games) You have 5 chances to guess each letter Let's begin: The second function's name is getNumberOfGame, which asks the user about the number of games to be played and returns the value. This function will validate the user input to make sure it is in the desired range (1-4) inclusive, if the value is out of range the user is notified and asked again . How many games do you want to play (1-4)3 .The third function's name is compareTwoCharacters, which receives two parameters of type character (e.g. the character to be guessed in that game and the character typed by the user). This functions return 0 if the two characters are the same, returns 2 if the first parameter comes after the second parameter, otherwise it returns -2. The fourth function's name is playOneGame, which receives one parameter of type character (the character to be guessed in that game). This function returns true if the user won; otherwise will return false. This function will handle all tasks to play one game (ask the user to enter their guess, provide up to 5 chances to guess, provide a hint to the user, etc.). This function is going to call the third function i.e. compareTwoCharacters) to decide if the user has guessed the correct ans . wer or to provide a hint to the user

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

b. Did you suppress any of your anger? Explain.

Answered: 1 week ago