Assignment 4
Instructor: Dr. James Parrish
11.2 Write a servlet that returns a randomly chosen greeting from a list of five different greetings. The greetings must be stored as constant strings in the program.
11.8 Write the markup document to create a form with the following capabilities:
a. A text widget to collect the user’s name
b. Four checkboxes, one each for the following items:
i. Four 25-watt light bulbs for $2.39
ii. Eight 25-watt light bulbs for $4.29
iii. Four 25-watt long-life light bulbs for $3.95
iv. Eight 25-watt long-life light bulbs for $7.49
c. A collection of three radio buttons that are labeled as follows:
i. Visa
ii. Master Card
iii. Discover
<!DOCTYPE html>
<!–– bulbs.html
ordering bulbs
––>
<html lang = "en">
<head> <title> Ordering bulbs online </title> <meta charset = "utf-8" />
</head>
<body>
<h2> LightUpYourLife.com </h2>
<p>
<html lang="en"><head>
<title> Vegeta’s Light Bulb Ordering Layout</title>
<meta charset="utf-8">
<body>
<p>
<label> <b>Customer Name:</b> <input name="Name" type="text"></label>
<br>
<br>
<br>
<b>Select your bulbs</b>
</p>
<p>
<label><input name="lights[]" value="4x25-watt" type="checkbox"> Four 25-watt light bulbs for $2.39 </label><br>
<label><input name="lights[]" value="8x25-watt" type="checkbox"> Eight 25-watt light bulbs for $4.29 </label><br>
<label><input name="lights[]" value="4x25-watt long-life" type="checkbox"> Four 25-watt light long-life bulbs for $3.95 </label><br>
<label><input name="lights[]" value="8x25-watt long-life" type="checkbox"> Eight 25-watt long-life light bulbs for $7.49 </label><br>
</p>
<b>Select your payment</b>
<p>
<label><input name="pmt" value="visa" type="radio"> Visa </label><br>
<label><input name="pmt" value="mastercard" type="radio"> Mastercard </label><br>
<label><input name="pmt" value="discover" type="radio"> Discover </label><br>
<label><input name="pmt" value="Paypal" type="radio"> Paypal </label><br></p>
<input value="Submit" type="submit">
<input value="Clear" type="reset">
<p></p>
</form>
</body></html>
11.9 Write a servlet that computes the total cost of the ordered light bulbs from Exercise 11.8 after adding 6.2 percent sales tax. The servlet must inform the buyer of exactly what was ordered, in a table.