Java - Gadget Order Taker

(#13 on page 670 – 671) Gadgets by Mail sells many interesting items through
its catalogs. Write an application that prompts the user for order details, including item
numbers and quantity of each item ordered, based on the available items shown
in Table 12-2.
Table 12-2
Items offered by Gadgets by Mail
Item # Description Price ($)
101 Electric hand warmer 12.99
124 Battery-operated plant waterer 7.55
256 Gerbil trimmer 9.99
512 Talking bookmark 6.89
The shipping and handling fee for an order is based on the total order price, as shown
in Table 12-3.
Table 12-3
Shipping and handling fees charged by Gadgets by Mail
Price of Order ($) Shipping and Handling ($)
0–24.99 5.55
25.00–49.99 8.55
50.00 or more 11.55
Create the following classes:
 Gadget, which contains an item number, description, and price for a gadget; a
constructor that sets all the fields; and get methods to retrieve the field values.
 Order, which contains an order number, customer name, and address (assume you
need just a street address, not city, state, and zip code); a list of item numbers ordered
(up to four); the total price of all items ordered; and a shipping and handling fee for the
order. Include a constructor to set the field values and get methods to retrieve the field
values.
GadgetOrderTaker, which is an interactive application that takes four customer orders.
The class contains an array of the four Gadget objects offered (from Table 12-2). The
application prompts each user for a name and street address and assigns a unique
order number to each customer, starting with 101. The application asks each user to
enter an item number and quantity wanted. When the user enters 999 for the item
number, the order is complete, and the next customer can enter data. Each customer
can order up to four item numbers. When a customer’s order is complete (the customer
has entered 999 for an item number, or has ordered four different items), calculate the
shipping and handling charges. After four customers have placed Orders, display each
Order’s data, including the order number, the name and address of the customer, and
the list of items ordered, including the item number, description, and price of each
Order, the total price for the order, and the shipping and handling charge.
The GadgetOrderTaker class handles all thrown Exceptions by displaying an explanatory
message and ending the application.
 OrderException, which is an Exception that is created and thrown under any of the
following conditions:
 A customer attempts to order more than four different items.
 A customer orders more than 100 of any item.
 A customer enters an invalid item number.
 Also, catch the Exception generated by either of these conditions:
 A customer enters a nonnumeric character as the item number.
 A customer enters a nonnumeric character as the quantity.
Save the files as Gadget.java, Order.java, GadgetOrderTaker.java,
and OrderException.java.
 The GadgetOrderTaker class handles all thrown Exceptions by displaying an explanatory
message and ending the application. Create a new application that handles
all Exceptions by requiring the user to reenter the offending data. Save the file
as GadgetOrderTaker2.java.Attachments