Categories: Uncategorized

MasterMind Java project

Write a new program that will be written in its own separate class. It will be a guessing game where the user tries to guess a five-digit number. The guessing game program will use the Math.random() random number generator to generate five numbers between from 0 to 9, storing those numbers in a single String. The player then tries to guess the number. With each guess the program returns two numbers, the first is the number of correct digits that are in the proper position and the second number is the sum of the correct digits. When the user enters the correct five digit number the program returns a statement that tells them that the user found the correct number, and how many tries it took the user to find the number. Allow the user to repeat the game as many times as they wish without leaving the game. Guarantee the numbers entered are 5 digit numbers. You must use at least 3 separate methods in the game. 1) Game setup, this includes the setting of all variables and building a new 5 digit number. 2) Top level control logic of the game. 3) Menu printing and retrieving user input. This game is to be added to and called from your Menu Control program.

A sample run of the game would look something like this:

Welcome to the Mastermind Number Game!
Your job is to guess the digits of a 5 digit number.
There is a new 5 digit number for you to find.
Please enter your guess.
02473
You have found 2 digits in the correct position, with a sum of 4.
Please enter your guess.
08459
You have found 3 digits in the correct position, with a sum of 13.
Please enter your guess.
06439
You have found 4 digits in the correct position, with a sum of 19.
Please enter your guess.
06429
Congratulations. 06429 is correct!
It took 4 guesses to get the number.
Would you like to play the game again?
Please enter (yes/no) maybe
Please enter (yes/no) yes
There is a new 5 digit number for you to find.
Please enter your guess.
00000
You have found 1 digits in the correct position, with a sum of 0.
Please enter your guess.
01111
You have found 3 digits in the correct position, with a sum of 2.
Please enter your guess.
01122
You have found 1 digits in the correct position, with a sum of 0.
Please enter your guess.
02211
Congratulations. 02211 is correct!
It took 4 guesses to get the number.
Would you like to play the game again?
Please enter (yes/no) no
Thank you for playing the Mastermind Number Game!

admin

Share
Published by
admin

Recent Posts

Childbirth

For this short paper activity, you will learn about the three delays model, which explains…

1 year ago

Literature

 This is a short essay that compares a common theme or motif in two works…

1 year ago

Hospital Adult Medical Surgical Collaboration Area

Topic : Hospital adult medical surgical collaboration area a. Current Menu Analysis (5 points/5%) Analyze…

1 year ago

Predictive and Qualitative Analysis Report

As a sales manager, you will use statistical methods to support actionable business decisions for Pastas R Us,…

1 year ago

Business Intelligence

Read the business intelligence articles: Getting to Know the World of Business Intelligence Business intelligence…

1 year ago

Alcohol Abuse

The behaviors of a population can put it at risk for specific health conditions. Studies…

1 year ago