Java Reference
In-Depth Information
F IGURE 18.29
This applet guesses the birthday.
the user to select a question type and difficulty level, as shown in Figure
18.30a. When the user clicks the Start button, the program begins to generate
a question. After the user enters an answer with the Enter key, a new question
is displayed. When the user clicks the Start button, the elapsed time is dis-
played. The time is updated every second until the Stop button is clicked. The
correct count is updated whenever a correct answer is made.
(a) Before a session starts
(b) After a session is started
F IGURE 18.30
The applet tests math skills.
***18.27
( Graphs ) A graph consists of vertices and edges that connect vertices. Write a
program that enables the user to draw vertices and edges dynamically, as
shown in Figure 18.31. The radius of each vertex is 20 pixels. Implement the
following functions: (1) The user clicks the left-mouse button to place a vertex
centered at the mouse point, provided that the mouse point is not inside or too
F IGURE 18.31
The applet enables users to draw a graph dynamically.
Search WWH ::




Custom Search