Lab 12

Goals:



Using the Konqueror browser, go to the course web-page: http://www.cs.uni.edu/~fienup/cs062s06 and click on the Lab12.zip link and "Save to disk" in the cs2 subdirectory created in lab 1. In a shell window, change to the cs2 subdirectory. Use the "ls" command to list the files in the directory and look for the file "Lab12.zip". Decompress the "Lab12.zip" using the command "unzip Lab12.zip", then change to the Lab12 subdirectory.

Part A: Converting an application to an Applet Change to the partA subdirectory. Compile and run PinBallGameDriver.java. Your task in part A is to convert the pinball game to run as an applet rather than as an application. Write a simple HTML page to view your applet that's similar to what I did with the Cannon World http://www.cs.uni.edu/~fienup/cs062s06/sessions/session24/CannonWorld_Applet.zip Use the subdirectory "web" off your home directory to store you codebase. See the notes at http://www.cns.uni.edu/cns-computing/help/www.html

Part B: Java Network Programming Change to the partB subdirectory. In an editor open the PocketChange.java file that contains a representation for some amount of pocket change in either British or American coins. Also open the ChangeMaker.java file which contains a partial server program to convert PocketChange either from British coins to American, or the reverse. For Part B of the lab, you are to complete the following tasks:

  1. Complete the ChangeMaker server so it can convert American to British coins.

  2. Write a client program that will interface with this server. Allow the user the ability to specify input as either American or British currency.

  3. After testing your client and server by running both on your machine ("InetAddress.getLocalHost()" in the constructor to the Socket in the client), run the server on your neighbor's computer and have the client connect to it from your computer. To do this:

    a) In a shell on your machine, open up a secure shell to your neighbors machine by: ssh wrt112-##.cslab.uni.edu where the ## are replaced by the machine number on the back of your neighbor's computer

    b) In the secure shell window, change to the directory where your server code resides and start running.

    c) In a shell window on your machine, run your client with the modification of ("InetAddress.getByName("wrt112-##.cslab.uni.edu")" in the constructor to the Socket in the client).

Near the end of the lab, raise your hand and demo your best attempt to complete Lab 12 to the TA (Patrick) or instructor.

Extra Credit: 3) Modify the ChangeMaker server to service each client in a separate thread (similar to the Therapist server).