In a file named
FoodOrder.java, you are to implement
a solution similar to exercise 13 on page 347. This program is based on a
solution to chapter 6 exercise 16 (which you'll have to create from scratch,
since we didn't do that exercise). The setting for this assignment is a computerized
food-ordering system. Customers are allowed to order entrees, side dishes,
and drinks. Each category can be skipped (so the customer does NOT order
anything from that category) or have multiple orders (both multiple selections
from a category, as in ordering both tofu burgers and cajun chicken sandwiches,
as well as repeated orders of a single selection, like 3 cajun chicken sandwiches).
Here is a list of the items in each category and their prices.
Entree
|
Side Dish
|
Drink
|
Tofu Burger $3.49
|
Rice Cracker $0.79
|
Cafe Mocha $1.99
|
Cajun Chicken $4.59
|
No-Salt Fries $0.69
|
Cafe Latte $1.99
|
Buffalo Wings $3.99
|
Zucchini $1.09
|
Espresso $2.49
|
Rainbow Fillet $2.99
|
Brown Rice $0.59
|
Oolong Tea $0.99
|
Your program should ask the user for their entree order, their side dish
order, and finally their drink order. It should print out (in an Outputbox)
a nicely formatted receipt for their order, with their total, including 6%
tax. Use the Format class to ensure that monetary amounts look correct, that
is, if they order a cajun chicken sandwich and espresso, their total should
be $7.50, and it should print exactly like that (not $7.5 or $7.5048 etc.).
The receipt should indicate which items they ordered, and how many (with
proper pluralization if you can manage it). For example, a typical receipt
might read:
Thank you for ordering
2 cajun chicken sandwiches,
1 rainbow fillet,
3 zucchinis,
1 Oolong tea.
Your total is $17.42
Use a ResponseBox to ask if they'd like to order from each category (entree,
side dish and then drink).
Use a ListBox within each category to get their order. One item on each ListBox
should be "No entree order" or "Quit" (or something similar). If the user
selects this item, or presses cancel, or makes no selection, your code should
move on to the next category.
If they select an item within a category, use an InputBox to ask them how
many of that item they'd like. Try to verify that they give legitimate values
for the number of items (i.e. positive integer values).
You should use a loop to allow them to order several different items from
within a category. If they happen to order 2 cajun chicken sandwiches and
then later order 1 cajun chicken sandwich, try to make it so your code outputs
an order for 3 cajun chicken sandwiches (instead of just their last ordered
number).