46-690 Object-Oriented Programming III Homework 1 Introductory C# and Remote Method Invocation Due: Midnight Friday 1/30/04 Assignment: Write two well documented programs in C#. The first program will be named ArithmeticClient.cs. This program will provide the user with a graphical user interface. The user will be allowed to enter two integers and will be allowed to select from one of three buttons labeled "Close", "Add", and "Multiply". If multiplcation or addition is selected the ArithmeticClient.cs class will make a remote method call on the second program, ArithmeticServer.cs. The ArithmeticServer class will perform the requested operation and pass the result back to the client. The client will display the result to the user and will allow the user to continue with additional operations or hit the close button. The Close button will end the application. The ArithmeticServer class will have a well known name. There will be a second server side program that associates the well known name with an ArithmeticServer object. In the code described below, this start up program on the server side is called ServiceStartup.cs. You need not perform error checking. You may assume that the input is valid. My Solution: In my solution I have a directory called DistributedCalculator. Within this directory I have two subdirectories named ClientSide and ServerSide. Within the ServerSide directory I have the following files: ArithmeticServer.cs This file holds a C# class called RemoteCalculator which inherits from the MarshalByReference class. It has one method for addition and one for multiplication. ArithmeticServer.dll This file resulted from compiling the ArithmeticServer.cs with the command csc -t:library ArithmeticServer.cs ServiceStartup.cs This file is a C# class that is modeled after the code in Server.cs (that is given on the course slides.) It makes the ArithmeticServer calculator available for use by remote clients. ServiceStartup.exe This file resulted from a compilation with the command csc -t:exe -r:ArithmeticServer.dll -r:MSCorLib.dll ServiceStartup.cs The arrithmetic service is run by typing ServiceStartup. The execution of the server makes the RemoteCalculator class (defined in ArithmeticServer.cs) available for visits. Within the ClientSide directory I have the following files: ArithmeticServer.dll This file was copied from the server side and placed on the client side. This placement provides only type information to the compiler. We will still be calling the calculator that exists on the server. ArithmeticClient.cs This code contains the graphical user interface code. When the Multiply button is clicked the Multiply method on the server is called. The result is placed in a third text box in the GUI. ArithmeticClient.exe This file was created by the command csc -r:ArithmeticServer.dll ArithmeticClient.cs The arithmetic service client is run with the command ArithmeticClient. Submission: Please paste three files to blackboard. There must be two ".cs" files from the server side and one from the client side. The files must contain documentation describing each method call and each method definition.