Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java Lab6B: Min/Max We are going to practice working with a while loop. For this program, prompt the user to enter an integer between
In Java
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 , the program will print out the maximum and minimum numbers and then stop running. To prevent errors, you need to initialize your minimum to be the value 1001 and your maximum to be -1001. Remember, your numbers must be integer values. Here's 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 99Step 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