hw

profileRabiya hossain

 

JSP and MySQL Assignment

1.      Create a database called premiergardens2 using MySQL.

2.      Create a table inventory in the premiergardens2 database.

3.      Create the following fields for the inventory table – toolid CHAR(5) (Primary Key), toolname CHAR(30), wholesale DECIMAL(7,2), retail DECIMAL(7,2), sold INTEGER, and inventory INTEGER.

4.      Create a front-end HTML form, insertinventory.html, with text fields that will allow you to enter the following data into the inventory table.  Do not hard code this information.  Please insert one record at a time in the inventory table using a JSP script inserttools.jsp.

toolid
 

toolname
 

wholesale
 

retail
 

sold
 

inventory

TS234
 

Tractor Scooter
 

85.03
 

97.95
 

122
 

26

GH178
 

Greenhouse
 

82.19
 

119.59
 

9
 

155

ED829
 

Edger
 

83.22
 

115.99
 

55
 

115

HS398
 

Hot Stick
 

212.44
 

318.99
 

26
 

75

PS098
 

Pole Saw
 

226.99
 

342.95
 

33
 

15

5. Write a JSP script, displaytools.jsp, that will display all of the records in the inventory table.

6. Create a front-end HTML form that simulates the sale of tools, selltools.html. 

7. Write a JSP script, toolsales.jsp, that will run one update query for sold and a second update query for inventory.  Thus, when the user selects an item, decrement the number of items in inventory and then increment the number of items sold.

8. Run the script created in step 5. to verify that the values are updated.

9.  Create a front-end HTML form, profits.html, that will have radio buttons that will allow the users to query the database table.

            a. Show the total profit and number sold for the tractor scooter.

            b. Show the total profit and number sold for greenhouse.

            c. Show the total profit and number sold for edger.

            d. Show the total profit and number sold for hot stick.

            e. Show the total profit and number sold for pole saw.

            f. Show the total profit and number sold for all items.

10. Write a JSP script gardenprofits.jsp.  You must run a different SELECT query for each tool.  The profit is computed as sold * (retail – wholesale).

    • 2 years ago
    • 10
    Answer(0)