Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
JAVA PPROGRAM ASAP
 
Please create  this program ASAP BECAUSE IT IS MY LAB ASSIGNMENT #2 so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. 
 
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.
 

Test Case 1

 
 
Enter a series of numbers separated only by commas or type QUIT to exit:\n
7,9,10,2,18,6ENTER
The sum of those numbers is 52.00\n
Enter a series of numbers separated only by commas or type QUIT to exit:\n
ENTER
Empty string.\n
Enter a series of numbers separated only by commas or type QUIT to exit:\n
8.777,10.9,11,2.2,-18,6ENTER
The sum of those numbers is 20.88\n
Enter a series of numbers separated only by commas or type QUIT to exit:\n
quitENTER
 

Test Case 2

 
 
Enter a series of numbers separated only by commas or type QUIT to exit:\n
invalid_input_hereENTER
Invalid input.\n
Enter a series of numbers separated only by commas or type QUIT to exit:\n
1,2,3ENTER
The sum of those numbers is 6.00\n
Enter a series of numbers separated only by commas or type QUIT to exit:\n
quitENTER
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education