You are to create an online ordering and stock control system for a mail order company. The system is to be operated by an employee of the company and is to be implemented in two distinct ways:
(a) using a GUI;
(b) using a Web interface.
Each implementation is to provide the functionality listed below.
(i) Retrieval of an individual stock item's current level.
(ii) Calculation of the cost of a customer's order for one or more of a particular stock item.
(iii) Addition of a new item of stock.
(iv) Display of the full stock list.
The functionality for item (ii) above is to be provided by a JavaBean called *OrderCost*, whilst that for the other three items is to be provided by a second JavaBean called *StockAccess*.
This assignment will require the creation of 10 source files:
· 3 Java files (2 of which are JavaBeans);
· 5 JSP files;
· 1 HTML file;
· 1 MS Access database (holding one small table).
The creation and testing of these files should be carried out in six distinct stages, as described below.
**1. Create the *Stock* table (in an Access database)**
This table is to hold at least eight items of stock with the following fields and associated types:
· stock code (Text:1 letter + 3 digits);
· stock description (Text);
· current level (Number);
· reorder level (Number);
· price (Currency).
The bean should have variables to hold an item's stock code and its order quantity and should provide mutator ('set') methods that assign values to the stock code and associated quantity respectively for a particular order. (For simplicity's sake, each order is to involve only one stock code.) By employing JDBC to retrieve the price of the item from the *Stock* table, the program should also provide an accessor ('get') method to return the cost of the order. If an item is not found, then zero should be returned.
For initial testing purposes, it will be convenient to include a 'rough and ready' *main* method that accepts a stock code and quantity from the user and displays the cost that is returned by the accessor method (to two decimal places). However, *main* should be deleted when the program is converted into a JavaBean.
**3. Create the**<st2:PersonName><st1:GivenName>***StockAccess***</st1:GivenName> <st1:Sn>**JavaBean**</st1:Sn></st2:PersonName>
This bean will use JDBC to provide the stock control functionality for the later application (in both the GUI implementation and the Web-based implementation). The features to be provided are listed below.
· Return the current stock level for an item with a specified stock code (or -1 for an invalid code).
· Insert a new item of stock (all 5 fields).
This functionality will be achieved via the appropriate accessor and mutator methods.
As with the first bean, it will be convenient for testing purposes to include a basic *main* method that allows the user to select the required SQL statement and to supply the appropriate field value(s). Once again. this method should be removed when the program is converted into a JavaBean.
**4. Create a Graphical User Interface that uses the above two JavaBeans**
This GUI should display the cost of any order (for specified stock code and quantity) that the user enters, by making use of the *OrderCost* bean. It should also allow the user to select either of the database operations specified in step 3 and have the *StockAccess* bean execute the appropriate method(s), displaying the result returned by the query and a message indicating success (or failure) for the insertion. If an invalid stock code is supplied for order entry or for (attempted) retrieval of the current stock level, then an appropriate error message is to be displayed.
5. Create the HTML page and the JSPs
**First create a Tomcat Web application to contain the Web pages you are going to create and the JavaBeans that you have already created. Add to this Web application an HTML page that allows the user to select, via radio buttons, any of the options provided by the GUI described in steps 4 and 5. Then add a JSP that receives the user's selection and either displays the full stock list (for the option added in step 5) or accepts a stock code from the user and then redirects execution to one of three further JSPs (that will also have to be created). Each of these three JSPs will provide the functionality required by one of the three remaining options. Two of the JSPs will make use of the *StockAccess* bean, of course, while the other one (to display the cost of an order) will make use of the *OrderCost* bean.
At the bottom of each JSP, provide a button that allows the user to return to the initial HTML page to make another selection. You should also include a JSP error page that simply displays the exception generated (for any of the options selected) and allows the user to retry the operation.
**_Task for the coder_**
This whole assignment is complete, which I will be attaching.
Can you modify the GUI files, right now i have 7 java files, from which 2 are beans. But altogether i need 3 files, 2 Beans and 1 GUI. All different sections are split up on different files, can you bring them all in 1.
Please make the GUI as simple as possible, and please give brief description of every code.
Right now I have scroll bar and opening new windows codes inside my GUI, can you take them off please, i want the GUI to be very basic
Thank you very much
Tomcat, Jcreator on Windows XP