Java Reference
In-Depth Information
Table 5-6 displays the variable dictionary, or list of variables, for the Rooms
class.
Table 5-6 Variables for the Rooms Class
VARIABLE NAME
DATA TYPE
PURPOSE
numSmoking
int
An integer variable to hold the number
of smoking rooms to be generated
numNonSmoking
int
An integer variable to hold the number
of nonsmoking rooms to be generated
occupied[ ]
array of booleans
An array of boolean values, initially set
to false, to indicate the state of each
room (occupied or empty)
non
int
An integer variable passed to the Rooms
object holding the requested number of
nonsmoking rooms
sm
int
An integer variable passed to the Rooms
object holding the requested number of
smoking rooms
begin
int
An integer variable to hold the first
room number to check when
attempting a booking
end
int
An integer variable to hold the last room
number to check when attempting a
booking
roomNumber
int
An integer variable to hold the return
value from the bookRoom() method,
representing the booked room (zero if
none available)
smoking
boolean
A boolean value sent to the bookRoom()
method to indicate if the user has
chosen a smoking room
i
int
A variable to hold the increment during
loop structures
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. If possible, you also should step
through the solution with test data to verify that the solution meets the require-
ments. The user also should review the design to confirm that it solves the prob-
lem outlined in the requirements. By comparing the program design with the
original requirements, both the programmer and the user can validate that the
solution is correct and satisfactory.
Having analyzed the problem, designed the interface, and designed and vali-
dated the program logic, the analysis and design of the application is complete.
As shown in Table 5-1 on page 307, the next task in the development cycle is to
implement the design by creating a new Java program using TextPad.
 
Search WWH ::




Custom Search