-
February 24th, 2011, 02:25 PM #1Junior Member
- Join Date
- Feb 2011
- Posts
- 1
Client/Server Programming Protocol Help
Hi there, i've got a basic protocol which is used by a Client Server Program.
The program is basically a joke telling program (which can be found fully at this URL.) The main problem I am faced with is converting the IF/Else compound statements, to switch/case statements. The following is the full protocol code. Please help! ;o
Code:public String processInput(String theInput) { String theOutput = null; if (state == WAITING) { theOutput = "Knock! Knock!"; state = SENTKNOCKKNOCK; } else if (state == SENTKNOCKKNOCK) { if (theInput.equalsIgnoreCase("Who's there?")) { theOutput = clues[currentJoke]; state = SENTCLUE; } else { theOutput = "You're supposed to say \"Who's there?\"! " + "Try again. Knock! Knock!"; } } else if (state == SENTCLUE) { if (theInput.equalsIgnoreCase(clues[currentJoke] + " who?")) { theOutput = answers[currentJoke] + " Want another? (y/n)"; state = ANOTHER; } else { theOutput = "You're supposed to say \"" + clues[currentJoke] + " who?\"" + "! Try again. Knock! Knock!"; state = SENTKNOCKKNOCK; } } else if (state == ANOTHER) { if (theInput.equalsIgnoreCase("y")) { theOutput = "Knock! Knock!"; if (currentJoke == (NUMJOKES - 1)) currentJoke = 0; else currentJoke++; state = SENTKNOCKKNOCK; } else { theOutput = "Bye."; state = WAITING; } } return theOutput; }
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
OpenVPN client shuts down on server error
By NewtownGal in forum Linux and UnixReplies: 3Last Post: March 26th, 2009, 03:50 PM -
Why do manufacturers not allow both client/server on same interface simultaneously?
By gberz3 in forum Networking and InternetReplies: 5Last Post: April 17th, 2008, 03:07 PM -
Client-server LAN mail server?
By chrissucks in forum Networking and InternetReplies: 2Last Post: November 24th, 2005, 02:23 PM -
Setting up a Windows Server 2000 Advance Client-Server network
By chrissucks in forum Networking and InternetReplies: 9Last Post: November 21st, 2005, 08:04 PM -
Best Multi-Protocol IM Client?
By omalleytrading in forum General Tech DiscussionReplies: 10Last Post: May 26th, 2005, 10:08 PM



LinkBack URL
About LinkBacks



Reply With Quote

Hi If you installed Avira Antivirus correctly before, the above step should help you uninstall it successfully. Click Start menu and go to Control Panel.
How to remove Avira AV from Win 8?