Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

used c++ program Objectives: Use if statements Use random number generators Use multiple do while loops Understand ordering if and else if statements Instructions: This

used c++ program

Objectives:

Use if statements

Use random number generators

Use multiple do while loops

Understand ordering if and else if statements

Instructions:

This is a lot like Lab 4 but you must add more conditions and two loops to the program.

You are to design and implement an application that plays the Hi-Lo guessing game with numbers. The program should start by picking a random number between 1 and 100 (inclusive). After that, it should repeatedly prompt the user to guess the number.

On each guess, report to the user whether he or she guessed correct. If not, report whether the guess was too high, too low, out of range (less than 1 or greater than 100).

The user can choose -1 during a game to quit the current game early. If they decide to do this, please display that as the result of his or her guess instead of too low/out of range.

Continue accepting guesses until the user guesses correctly or chooses to quit. Make sure you count the number of guesses and report that value when the user guesses correctly or chooses to quit the game. If the user quits a game, just print that he or she has quit after so many guesses.

At the end of each game (by quitting or a correct guess), prompt the user to determine whether he or she wants to play again. Continue playing games until the user chooses to stop. You can use -1 for this quit response. You can also use a letter like Y or N or even use a String like yes or no. Consider using two do loops to solve this problem although there are many other correct ways if you prefer another solution.

Run:

Be sure to test all possibilities in your test run:

Run at least two continuous games, in which you prove the counter of guesses is resetting.

Then run a game in which the user exits early with a -1. Make sure you still print the count of guesses; do count the -1 as a guess.

Then run a game to completion but check for each of the out of range cases. A guess that is (< -1, == 0, andfinally > 100). Make sure you are counting out of range guesses as a guess also.

Keep running games until user decides to quit the whole program.

Submission:

Please submit the project, to the professor in class or in her office (J376) up to 5:30 on the due date. It should be in a project folder, same as Project 1. The folder should include: The assignment sheet, the algorithm, the source code, the output file, and the academic honesty promise.

Notes:

This project will use if statements and loops covered in Chapters 5 and 6.

EXTRA CREDIT: Code a loop and run the millionaire program which will be discussed in class. Run three times once with an amount of $10,000.00 and rate of 0.08. You may choose the other two data sets.

For the extra credit, turn in the source code and output at the end of the folder (run at least three times).

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago