Java Reference
In-Depth Information
Exiting a Console Application Using a VATE
Some value-added text editors (VATEs), including TextPad,
automatically display a “Press any key to continue” message after
displaying all the output in a console application. In most cases,
pressing any key exits the program in a manner similar to clicking
the Close button.
PROGRAM DESIGN Once you have designed the interface, the next step is
to design the logic to solve the problem and create the desired results. The only
programming task is to display three lines of output, one after another, on the
screen; therefore, the structure of the program will be sequential in nature. The
program code will send a print message to an object — in this case, the default
display device of your system (Figure 2-1a on page 47). The program code then
will be modified so that the program can run on the Web as an applet. The pro-
gram code for the applet will display the three lines of output in a window of
their own, along with a graphic (Figure 2-1b on page 47). Both the application
and the applet versions of the program should contain appropriate documenta-
tion and be saved for future use.
Figure 2-4a shows a flowchart that outlines the sequence of steps in the pro-
gram. Figure 2-4b shows an event diagram that illustrates how the execution of
the program triggers the Display event.
Begin
Welcome to My Day
Display "Welcome
to my day!"
User executes program
Display "Daily
planner for
Linda Nunez"
Welcome message, user's
name, and system date
display on the screen
System receives request
(b)
Display the
system date
For applet, display a
smiley face graphic and
set the background
color to cyan
End
(a)
FIGURE 2-4
 
Search WWH ::




Custom Search