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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
icon
Related questions
Question

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)
Transcribed Image Text: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)
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT