@@ -0,0 +1,2517 @@
+/**  Version 1.0%0A**/%0A%0Aimport java.net.*;%0Aimport java.io.*;%0A%0Apublic class vkProtocol %7B%0A    private static final int WAITING = 0;%0A    private static final int DISPLAYINGTC = 1;%0A    private static final int DISPLAYINGRESOURCES = 2;%0A    private static final int DOWNLOADING = 3;%0A    private static final int FINISHED = 4;%0A%0A%0A%0A    private static final int NUMRESOURCES = 4;%0A%0A    private int state = WAITING;%0A%0A    private String%5B%5D resources = %7B %22iTune%22, %22ZoneAlarm%22, %22WinRar%22, %22Audacity%22 %7D;%0A%0A%0A    public String processInput(String theInput) %7B%0A        String theOutput = null;%0A%0A        if (state == WAITING) %7B%0A            theOutput = %22Here are the terms of reference. Do you accept? Yes or No%22;%0A            state = DISPLAYINGTC;%0A        %7D%0A%0A        else if (state == DISPLAYINGTC) %7B%0A            if (theInput.equalsIgnoreCase(%22Yes%22)) %7B%0A                theOutput = %22%22;%0A                for(int i=0; i%3C resources.length; i ++)%7B%0A%0A                  theOutput = theOutput + resources%5Bi%5D + %22_%22;%0A                %7D%0A                state = DISPLAYINGRESOURCES;%0A            %7D%0A            else if (theInput.equalsIgnoreCase(%22No%22))%7B%0A              theOutput = %22Bye.%22;%0A              state = WAITING;%0A            %7D%0A            else%7B%0A              theOutput = %22Wrong input. Type Yes or No ONLY.%22;%0A            %7D%0A        %7D%0A%0A        else if (state == DISPLAYINGRESOURCES) %7B%0A          boolean found = false; //To identify whethere the resource had been found%0A          int resourceLocation = Integer.parseInt(theInput) -1;%0A          for (int i=0; i%3Cresources.length; i++)%7B%0A            if (resources%5BresourceLocation%5D == resources%5Bi%5D) %7B%0A                theOutput = %22You are downloading %22 + resources%5Bi%5D;%0A                state = DOWNLOADING;%0A                found = true;%0A                break;%0A              %7D%0A            %7D%0A%0A            if (!found)%7B%0A                theOutput = %22Invalid selection! Please choose again.%22;%0A          %7D%0A%0A        %7D%0A%0A        else if (state == DOWNLOADING) %7B%0A          theOutput = %22Enter BYE to exit, and ENTER to continue.%22;%0A          state = FINISHED;%0A        %7D%0A        else if (state == FINISHED) %7B%0A            if (theInput.equalsIgnoreCase(%22enter%22)) %7B%0A              theOutput = %22%22;%0A              for(int i=0; i%3C resources.length; i ++)%7B%0A                theOutput = theOutput + resources%5Bi%5D + %22_%22;%0A              %7D%0A                state = DISPLAYINGRESOURCES;%0A            %7D%0A            else %7B%0A                theOutput = %22Bye.%22;%0A                state = WAITING;%0A            %7D%0A        %7D%0A        return theOutput;%0A    %7D%0A%7D%0A

Create vkProtocol.java