Java Reference
In-Depth Information
CommissionApplet
window
text box for
input of sales
amount
graphic
input prompts
option buttons
for input of
commission
code
formatted
output
FIGURE 4-3b
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. Figure 4-4
shows the flowchart and related pseudocode that represents the logic of the
program. Each process symbol references the pseudocode for each of the five
methods required in this program. The main() method calls each of these five
methods after the program starts.
Display prompt to user
Test for Cancel button
If yes
Start
call Finish Procedure
Test for sales amount <= 0
If yes
display error message
repeat process
Get Sales
Else
return sales amount
Get Code
Display prompt to user
Test for invalid code
If yes
display error message
repeat process
Else
return code
Get Commission
If code = 1
commission = sales * .10
If code = 2
commission = sales * .14
If code = 3
commission = sales * .18
Return commission
Perform Output
Finish
Display formatted sales and commission
Exit all dialog boxes
End
FIGURE 4-4
 
Search WWH ::




Custom Search