Java Reference
In-Depth Information
The following step enters code for the bookRoom() method.
To Enter Code for the bookRoom() Method
1. Enter the code as shown in Figure 5-15 on the previous page.
The bookRoom() method is displayed (Figure 5-16).
declaration
of variables
if...else
statement
instance method,
bookRoom()
for loop
room number
assignment
FIGURE 5-16
In line 50, the roomNumber variable is assigned a value of the increment
plus one. Remember that arrays are numbered from zero to the end. Therefore,
room number 1 actually is the zero member of the array. As most establishments
would begin their room numbers with 1, adding one to the array index number
gives a more user-friendly numerical representation of the correct room number.
 
Search WWH ::




Custom Search