Question: Hello, Please source code to be in Java: Lab6A (Warmup): You may have played a game called Stop Repeating Yourself when you were a kid.
Hello, Please source code to be in Java:
Lab6A (Warmup): You may have played a game called Stop Repeating Yourself when you were a kid. The premise of the game is you repeat the phrase Stop Repeating Yourself over and over again to annoy the other person. We will write a program similar to this game. For this lab, you will prompt the user for input. If the user enters anything other than cookie, the program will respond with Gimme a cookie . To make the program stop running, the user needs to enter cookie. You need to write this program using a do-while loop. You will receive no credit if you use a for or while loop to solve this problem. Hint: Remember how to compare strings! The sample run is shown below. User input is in bold. Sample output: Gimme a cookie: who is this? Gimme a cookie: I'm not joking Gimme a cookie: What is going on? Gimme a cookie: help Gimme a cookie: cookie Lab6B: Min/Max We are going to practice working with a while loop. For this program, prompt the user to enter an integer between negative 1000 (-1000) and positive 1000 (+1000). After each number is entered, the program will print out the maximum and minimum number based on the numbers that have been entered so far. If the user enters 0, the program will print out the maximum and minimum numbers and then stop running. To prevent an out of bounds error, you need to initialize your minimum to be -1001 and your maximum to be +1001. Remember, your numbers must be integer values. Heres a challenge for advanced students: If you want to code this to work regardless of the range, how would you do it? You could use Math.MIN and Math.Max, but is there another way? The sample run is shown below. User input is in bold. Sample output: Enter a number between -1000 and +1000: 6 Min is 6 Max is 6 Enter a number between -1000 and +1000: 11 Min is 6 Max is 11 Enter a number between -1000 and +1000: -3 Min is -3 Max is 11 Enter a number between -1000 and +1000: 99 Min is -3 Max is 99 Enter a number between -1000 and +1000: -45 Min is -45 Max is 99 Enter a number between -1000 and +1000: 3 Min is -45 Max is 99 Enter a number between -1000 and +1000: 0 Min is -45 Max is 99
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
