Test 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

TEST 2

Question 1
Create a database called Sales with a single table called Stock. Give it the structure shown
below and enter a few rows of data for use in the later exercises. Make sure that there is
at least one item for which the current level is at or below the reorder level.
Field Name Type
stockCode Integer
description Text/String
unitPrice Real/Float/Currency
currentLevel Integer
reorderLevel Integer

1. Write a program to display the stock code, unit price and current level for all items in
table Stock.
2. Modify the above code to display description, current level and reorder level for all
items whose current level is at or below reorder level.
3. Take a backup of your database. Then create a program (using SQL strings) that will
insert one record, increase by 10% the unit price of each item of stock and delete one
record with specified stock code. The program should display stock codes and prices
of all items both before and after the changes.
4. Write a simple GUI-driven program that will allow the user to retrieve the current
stock level of any item whose stock code he/she enters (repeatedly, for as many items
as the user wishes).
Question 2
1. Copy ShoppingCart.html from section 8.8 into your Web app's root folder.
2. Create your own Selection servlet, placing it in the classes folder. This servlet should
generate a Web page that simply displays the name of the product selected by the user.
3. Add the appropriate tags to your deployment descriptor and compile the servlet.
4. Start up Tomcat (stopping it first, if it is already running) and then test the servlet by
accessing ShoppingCart.html in your browser window.
Question 3
Exercise 10.3 page 342

NOTE
• DISconnect Internet
• NOT Be allowed to discuss in the class

You might also like