Question: I need help with this Java program. Goal: Learn to write while loops with sentinels . Assignment: In a command - line tool for data
I need help with this Java program. Goal: Learn to write while loops with sentinels
Assignment: In a commandline tool for data analysis, users can input a series of data entries numbers or words on separate lines. The tool will then process these entries to output a summary on a single line, where numeric entries are added together, and string entries are concatenated, all separated by commas.
Given a Scanner reference variable named input associated with an input source of mixed data numbers and strings write the code to:
Read every line to determine if it's numeric an integer or textual.
Sum all numeric entries and concatenate all textual entries.
Print the sum of numeric entries followed by the concatenated text entries, separated by a comma.
For example, if the input consists of the lines "Hello", and "World", the output should be HelloWorld".
Hint: Use input.nextLine to read a line and input.hasNextLine to check for more input. You can then check if the next line is numeric with input.hasNextInt
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
