/***************************************************************************/ /* Name: README.1ST Author: Tracy M. Taylor / milic_t@cs.odu.edu Date: 24 Nov 97 Class: CS576 / Systems Programming / Dr. H.M. Abdel-Wahab Asg4: Use JAVA1.0 to create a Survey GUI tool where a Professor (Server) can send one question to each connected student (Client) and each student can respond. */ /***************************************************************************/ /* DESCRIPTION:: The teacher invokes the program with one argument [time] to control how long (the number of minutes) the survey should last. e.g. >java Survey 9 In such case the program behaves as a server and displays the following message to the teacher's standard output: >Let each student type: java Survey host port where host is the IP address of the machine and port is the server port number. In addition the program displays a interface similar to the teacher's interface of assignment #3 with the following modifications: 1. Replace the count-down counter with count-up counter, indicating the number of students who have been connected to the server. 2. In addition, a time-left counter should be added to the interface indicating the number of minutes remaining until no further votes are accepted. Note that the count-down does not start until the professor sends the survey question. 3. Although the survey results should be displayed to the professor interface as they arrive (like assignment #3), only the final result of the survey is sent to all currently connected students at the end of the survey (when the time-left reaches 0). This, unlike assignment #3, the students are not aware of the partial results of the survey, they can only see the final result. When a student types: >java Survey host port the program behaves as a client and establishes a TCP connection with the server (the teacher process). Upon the successful establishment of the TCP connection, the server sends to the client the number of minutes left until the end of survey. The student interface is similar to the student's interface of assignment #3, with only one modification: to add the time-left counter. When the time-left counter reaches 0, the student is not allowed to vote and the result of the survey is displayed (the result includes: the total number of students who have been connected to the teacher during the survey time, the number of YES votes and the number of NO votes). In this assignment, assume that the professor can not quit (i.e., disable the Quit button) until the end of the survey. However, the students may quit at any time during they wish. */ /***************************************************************************/ /* FILES: 1. README.1ST File containing a description of the assignment, author and list of files required to run the assignment. 2. Survey.java This source file is the driving program which displays a Professor or Student GUI and then creates a Server or Client process depending on the command line variables. 3. Makefile Compilation and dependencies specification file for the executable file 'Survey.class'. */ /***************************************************************************/ /* The following step-by-step procedures applies to running my program on the machines at Old Dominion University's Computer Science UNIX Lab (Norfolk, VA): USAGE: - Ensure that all the files delineated above are in a common working directory. - Type 'make' at the command line to produce the following class executables: AlarmClock.class CreateDisplay.class PostDialog.class ServeSurveyClient.class Survey.class -- primary executable - Type the following at the command line to ensure that the correct version of JAVA is used when executing the program: % setenv JAVA_PATH /research/java/JDK/bin - If you are logged into a remote machine from which you'll run the program, be sure to reset the DISPLAY environment variable on the remote machine so that the Survey GUI will display to the machine you're sitting in front of. % setenv DISPLAY :0.0 - To execute the program as a Professor, type: % $JAVA_PATH/java Survey e.g. % $JAVA_PATH/java Survey 1 whereupon the program will print out the 'hostname' (eg. sabine) and 'port' (eg. 13372) that a Student should use. - To execute the program as a Student, type: % $JAVA_PATH/java Survey e.g % $JAVA_PATH/java Survey sabine 13372 - In both cases, a Survey GUI is displayed and the Professor types a question while the Student waits for the question to arrive. Once the Professor sends the question, both GUI Timers start to count-down to indicate the amount of remaining time each Student has to answer the question (in mins and seconds). Once the timer reaches '0:00', the results of the Survey are promulagated to each connected Student and the Professor can then quit. The only case in which the Professor can quit beforehand is if no Student ever connected. Notes: The executable was tested successfully on WinNT4.0 and SunOS 5.5.1 machines at Inter-National Research Institue (not on ODU machines). */ /***************************************************************************/