Java Reference
In-Depth Information
94
95
public double getComm ( double sales, int code )
96
{
97
double commission = 0.0;
98
switch ( code )
99
{
100
case 1:
101
commission = .10 * sales;
102
break ;
103
104
case 2:
105
commission = .14 * sales;
106
break ;
107
108
case 3:
109
commission = .18 * sales;
110
break ;
111
}
112
return commission;
113
}
FIGURE 4-56
The following step enters the code for the getComm() method in the applet.
To Enter Applet Code for the getComm() Method
1. Enter the code for lines 94 through 113 as shown in Figure 4-56.
TextPad displays the getComm() method in the coding window
(Figure 4-57).
getComm()
method
FIGURE 4-57
Search WWH ::




Custom Search