Question: Design and implement a Java program (name it InputSum) that prompts the user to enter a positive integer number. The program should accept integers until

Design and implement a Java program (name it InputSum) that prompts the user to enter a positive integer number. The program should accept integers until the user enters the value -1 (negative one). After the user enters -1, the program should display the entered numbers followed by their sum as shown below. Notice that -1 is not part of the output.

Entered Number: 10, 2, 13, 50, 100

The Sum: 175

Entered Number: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

The Sum: 55

Entered Number: 1, 1, 1, 1, 100

The Sum: 104

Entered Number: 0, 0, 0, 0, 0, 100

The Sum: 100

Make sure the program validates each entered number before processing it as the user may enter negative numbers other than the sentential value -1. Design your program such that it allows the user to re-run the program with a different set of inputs in the same run as shown above. Document your code, and organize and space out your outputs as shown above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!