Exercise 2: Write a java program that asks a user to enter a set of positive integer values. When the user stops (think of sentinel value to stop), the program displays the maximum value entered by...


Exercise 2:<br>Write a java program that asks a user to enter a set of positive integer values. When the user stops<br>(think of sentinel value to stop), the program displays the maximum value entered by the user. Your<br>program should recognize if no value is entered without using counter.<br>Sample run:<br>run:<br>Enter a positive integer or (-1) to stop: 25<br>Enter a positive integer or (-1) to stop: 36<br>Enter a positive integer or (-1) to stop: 51<br>Enter a positive integer or (-1) to stop: -9<br>Maximum number entered is: 51<br>BUILD SUCCESSFUL (total time: 8 seconds)<br>run:<br>Enter a positive integer or (-1) to stop: -10<br>NO number is entered!<br>BUILD SUCCESSFUL (total time: 2 seconds)<br>

Extracted text: Exercise 2: Write a java program that asks a user to enter a set of positive integer values. When the user stops (think of sentinel value to stop), the program displays the maximum value entered by the user. Your program should recognize if no value is entered without using counter. Sample run: run: Enter a positive integer or (-1) to stop: 25 Enter a positive integer or (-1) to stop: 36 Enter a positive integer or (-1) to stop: 51 Enter a positive integer or (-1) to stop: -9 Maximum number entered is: 51 BUILD SUCCESSFUL (total time: 8 seconds) run: Enter a positive integer or (-1) to stop: -10 NO number is entered! BUILD SUCCESSFUL (total time: 2 seconds)

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here