Use Xlib to implement the following program:
The program creates an "order interface" (see figure below) on
display d1, d2, ...dn. Each person selects
the toppings that he likes and then clicks into the Send button.
As soon as a person clicks on the Send button, the interface in
each active display reflects the current state (the Count-Down counter
is
decrement by one and the Total counters of the toppings is incremented
accodring to the choices made by that person).
To select a topping, a person clicks into the square beside the topping.
In such case, an X is drawn
inside the square. To deselect an item, a person clicks into the corresponding
square and in such case
the X is removed from the square. A person may click on his/her
Send
button without selecting any of the available toppings. In such
case only the Count-Down counter is decrement by one. As soon as
a person clicks on his/her Send button, the choice boxes as well
as the Send button become insensitive (i.e., they do not respond
to any further mouse clicks).
Each person may click on the Quit button to exit from the program
at any time (since this is a serious operation, you should use a
dialogue window to confirm or cancel this operation). If the person who
quit the program is not the initiator, only his/her interface is removed.
The others may continue to use the program
and make thier selection. If the initiator clicks on the Quit button
(and confirms this action) the program writes the collected information
into a file (call it GoPizza.outpot) and then terminates. In such
case, all interfaces will be removed. Note that a person may quit before
or after making his/her selection.
Her is an example of the content of such file:
Number of persons invited: 6
Number of persons responded: 4
Mushrooms: 2
Onions: 0
Black Olives: 3
Green Peppers: 2
