I'm assuming the capitalizing client-server work and you're cool with all the concepts there. How to do the new problem ...
Think up a protocol for sending numbers. Will you send 1..n numbers in a single line, perhaps separated by spaces or commas? Then your current structure is pretty good. Instead of raising the line to upper case, break it into numbers (see String.split), add them up and send back the sum.
It might be more interesting (challenging == fun ) to send one number per line and send a blank line to indicate the end of the numbers. Then the protocol is more like:
A blank line as a terminator - the end of the numbers - looks a little like the HTTP protocol that uses a blank line at the end of all headers.
See if you can think of any other protocols. I have one more in mind - it would be cool if you could come up with a different one just to make the program your own. Does that give you a starting point? Holler if any of the other details - line parsing, making numbers out of strings - give you trouble.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Oct 21, 2004
Thanks for your reply.
I need to send numbers in a single line, seperated by a whitespace.
How will I scan string and get numbers out of it.
e.g. the user inputs: "12 03 77", which is a string. I need to get these individual numbers as 12, 03 and 77, and then add them(92). How will I do that.