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.

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter4: Financial Functions, Data Tables, And Amortization Schedules
Section: Chapter Questions
Problem 8AYK
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.

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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT