Java Reference
In-Depth Information
main
menu
Sort by
button menu
FIGURE 7-3b
The display should be formatted for easy viewing. Because so many different
fonts are available, it is good practice to provide users with samples of formatted
text from which they may choose. The display area in Figure 7-1 on page 433
uses a Sans Serif (without flourish) family of fonts, including italic, bold, and
large font attributes.
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 Classics
on DVD program will involve three logic tasks: data storage, searching, and
sorting.
First, because this is only a prototype while the program is running, the data
can be stored in arrays rather than in a database. While final versions of the
application would probably store the data on external storage devices, this pro-
gram will use three arrays to store data: one for the movie title, one for the name
of the studio, and one for the year the movie was released. These arrays will have
to be kept parallel , or in sync, with one another as they are sorted to keep the
correct movie with the correct studio with the correct year. The subscript num-
ber of a movie title must be the same as the subscript number of the matching
studio and year in the respective arrays for purposes of displaying the informa-
tion correctly as well as for sorting. The subscript is the same for each piece of
movie data, forming a complete record stored at the same number across these
parallel arrays (Figure 7-4). Java handles parallel arrays efficiently, but program-
mers must be careful with their logic when using them. You will learn more
about storing data permanently in a later chapter.
 
Search WWH ::




Custom Search