Java Reference
In-Depth Information
4 User Decisions (continued)
Create a Java applet similar to the one shown in Figure 4-69 that calculates
the shipping cost for customer purchases. Eventually, the program will read the
total price of purchases as data from the Web page; for now, the user will be able
to enter the total price as an input value and then have the program calculate
shipping charges. If a customer wants priority delivery (overnight), then the
shipping charge is $16.95. If the customer prefers express delivery (2 business
days), then the shipping charge is $13.95. If the customer wants standard deliv-
ery (3 to 7 business days) and the total cost of the order is more than $100.00,
then CandleLine ships the items to the customer free; if the order is less than
$100.00, then CandleLine charges $7.95 for standard delivery.
FIGURE 4-69
5 Freddie's Fast Food
Create an applet that displays an interface related to fast-food sandwiches
created at Freddie's Fast Food. Using the techniques you learned in Chapter 4,
add user interface components, including Checkboxes for the condiments and a
CheckboxGroup with Checkboxes for the sizes. Add enough code to the program
to make the selection of both the CheckboxGroup and Checkboxes work.
1. Start TextPad. Save the file on the Data Disk using the file name Freddie.java.
2. Enter general documentation comments, including the name of this lab,
your name, the date, and the file name.
3. Import the following packages: java.awt.*, java.applet.*, and java.awt.event.*.
Remember to use the import statement and conclude each line with a
semicolon.
Search WWH ::




Custom Search