logo CodeStepByStep logo

SentinelSum

Write a complete console program in a class named SentinelSum that prompts the user for numbers until the user types -1, then outputs the sum of the numbers. Here is an example output:

Type a number: 10
Type a number: 20
Type a number: 30
Type a number: -1
Sum is 60
Class: Write a complete Java class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.