Assignment #2

Due Monday October 6, 1997


Use Xlib to implement the following program:

NAME

Survey : A simple survey tool

SYNOPSIS

survey d1 d2 [d3 … dn]

DESCRIPTION

d1, d2, .. dn are display values, e.g., pitfal:0. The values of n is at least 2 and at most 6. d1 is the "professor" display, while d2-d6 are students displays.

The program creates a "professor interface" (see Figure 1 (a)) on display d1. If the professor types any question, e.g., "Do you like this assignment?" and clicks into the Send button, the question appears on each "student interface" (see Figure 1 (b)). If the professor clicks into Send without typing anything, a warning in the form of "Bell" sound is issued.

 If a student clicks inside box labeled "Yes", an X is drawn inside the Yes box and is removed from the No box, if there was one. Similarly, if the student clicks inside the box labeled "No" an X is drawn inside the No box and is removed from the Yes box, if there was one. If a student clicks into Send without clicking into either Yes or No boxes, a warning in the form of a "Bell" sound is issued.

 In either the professor or student interfaces, a "Count-down" box shows the number of total students who are expected to answer the survey question. As the answers from students are returned, the Yes, No and Count-down counters are updated. When the value of Count-down reaches 0, indicating that all students have answered the question, each participant may click on the Quit button to remove his/her interface. If a student clicks on the Quit button "before" answering the question, the Count-down is decreased by one, while the Yes and No counters are not changed. If the professor clicks on the Quit button, the program exits and all interfaces are removed.

NOTE: The "Send" button of an interface should be disabled right after a successful send. Therfore, the professor is allowed to ask only one question and each student is allowed to cast only one vote.


Back to Assignments Page
Back to CS476/576 Home Page