Java Reference
In-Depth Information
sorted by
title
sorted by
studio
FIGURE 7-4
The second logic task is to search for a user-requested movie. As the list
of movies in the prototype is relatively short, a linear search might be appropri-
ate. Performing a linear search — also known as a sequential search — means
searching the list one by one from top to bottom. Search data will be entered by
the user via a JOptionPane input dialog box. The data then will be compared
with each member of the array, looking for a match. If found, the corresponding
data is displayed; otherwise, a message box displays, notifying the user that no
results were found. Figure 7-5 displays the message box.
FIGURE 7-5
The third logic task will be to sort the data by a given field. With each array
representing a field of data, input from the user will specify which array to sort.
Because the arrays are parallel, the other two arrays must be sorted in a manner
consistent with the first. As the sort moves an item in the first array, the same
move will be made in the other two, keeping the record together across the
arrays (Figure 7-4).
VALIDATE DESIGN Once you have designed the program, you can validate
the design by stepping through the requirements document and making sure
that the design addresses each requirement. The validation process becomes
extremely important with a prototype. Together, you and the user should
step through the solution with test data to verify that the solution meets the
 
Search WWH ::




Custom Search