Question
Chapter 9. PC #8. 8. Sum of Numbers in a String (page 610) Write a program that asks the user to enter a series of
Chapter 9. PC #8. 8. Sum of Numbers in a String (page 610) Write a program that asks the user to enter a series of numbers separated by commas. Here are two examples of valid input: 7,9,10,2,18,6 8.777,10.9,11,2.2,-18,6 The program should calculate and display the sum of all the numbers. Input Validation 1. Make sure the string only contains numbers and commas (valid symbols are '0'-'9', '-', '.', and ','). 2. If the string is empty, a messages should be displayed, saying that the string is empty.
Enter a series of numbers separated only by commas or type QUIT to exit: The sum of those numbers is 52.00 Enter a series of numbers separated only by commas or type QUIT to exit: Empty string. Enter a series of numbers separated only by commas or type QUIT to exit: The sum of those numbers is 20.88 Enter a series of numbers separated only by commas or type QUIT to exit:
Please it is important to use the EXIT_SENTINENTAL = "QUIT"; and the numbers must use 2 decimals. In java programming language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started