Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WeBWc X Find ac X SA polyn X Assignn X Prograr X CSE110 X return ndan/Downloads/Assignment_04_Instructions.pdf @ Maps School canvas Dashboard | SRP PO... View
WeBWc X Find ac X SA polyn X Assignn X Prograr X CSE110 X return ndan/Downloads/Assignment_04_Instructions.pdf @ Maps School canvas Dashboard | SRP PO... View Our Help Desk Java Concepts, Late... Macro df 1131 89% CSE110 Principles of Programming Assignment 04:100 pts Assignment 04 - Master Mind You must work in alone on this assignment. Do not use any Java language features we have not cover so far in this course. Assignment Objectives After completing this assignment the student should be able to: Write programs that use loops to repeat instructions Demonstrate the use of while or for loops in Java Use conditional expression to control loops and decisions . Assignment Requirements For this assignment you are given the following files: Assignment04.java (you must complete this file) Problem Description and Given Info Within the main method in the Assignment04.java file, you must write a program to play a game of Master Mind with the user Your program will choose a random 3 digit number as the secret number. Your program must prompt the user to enter a 3 digit number as their guess. The program will respond with a message indicating how many of the digits in the user's guess are the same as the digit in the same position in the secret number. For example, if the secret number is 374, and the user's guess is 473, then the program would respond with the message You matched 1, because only one of the digits (the 7) in the user's guess is the same as the digits in the same position in the secret number. The program will allow the user to continue to enter guesses until they guess the correct secret number. After the user has entered the secret number, the program will output a count of the total number of guesses the user took to find the secret number. Then the program will ask the user if they would like to play again. If the user answers "yes", then the program will choose another random 3 digit number and play continues as described above. Here's an example interaction (user input in bold): MASTERMIND 7 a Priser FAN Insert F12 F3 F4 F5 F6 FB FO FIO F7 # % * $ & 3 4 5 6 7 9 8 CSE110 X return X WeBW X Find ac X Assignn X C Prograr X = java - ( x S A polyr X Brendan/Downloads/Assignment_04_Instructions.pdf Macro Maps School canvas Dashboard | SRP PO... Java Concepts, Late... View Our Help Desk 1 / 3 | 89% ns.pdf took to find the secret number. Then the program will ask the user if they would like to play again. If the user answers "yes", then the program will choose another random 3 digit number and play continues as described above. Here's an example interaction (user input in bold): MASTERMIND ----- Guess the 3 digit number! Guess 1: 000 You matched o Guess 2: 111 You matched 1 Guess 3: 123 You matched 1 Guess 4: 244 You matched 2 Guess 5: 144 You matched 3 Congratulations! You guessed the right number in 5 guesses. Would you like to play again (yeso)? P.Miller O a C rch Priser Insert Find ac X S A polyn X eBW X Assignr X C Prograr X CCSE110 X return - X java - dan/Downloads/Assignment_04_Instructions.pdf Maps School canvas Dashboard | SRP PO... View Our Help Desk Java Concepts, Late... Macro df 2 / 3 89% + 1 P.Miller Assignment 04-100 pts CSE110 Principles of Programming Program Pseudocode Template You may use the following template if you find it helpful. While the user wants to play another game Pick a new secret number While the user's guess is not completely correct Prompt the user to make a guess User enters a guess Display number of correct digits in user's guess Congratulate the user and tell them the number of guesses they took Ask the user if they want to play again Priser WIS FO
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started