Question: Write a Java program, named InputSum, which prompts the user to enter positive integer numbers using a sentinel while loop. The program should accept integer
Write a Java program, named InputSum, which prompts the user to enter positive
integer numbers using a sentinel while loop. The program should accept integer inputs until the user enters
the value negative one is the sentinel value that stops the while loop After the user enters the program
should display the entered numbers followed by their sum as shown below. Notice that value is not part of
the output. The program should ignore any other negative input and should continue to run.
Make sure the program validates each entered number before processing it as the user may enter negative
numbers other than the sentinel value
Hint: to remembersave the entered good positive values, you can concatenate them into a string separated
by comas that you can output later on
Design your program such that it allows the user to rerun the program with a different set of inputs in the
same run ie use a sentinel loop, see example on slide chapter This characteristicbehavior will be
required for future programs, so please make sure you learn how to code sentinel loops in your
programs going forward.
Document your code, organize, and space out your outputs as shown below. The following sample tests show
the input prompt and the output labels. Notice the user may enter all values on one line first test or one value
per line second test DO NOT read inputs as String type. Make sure your code displays the outputs
following the test data format
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
