Provide two Java statements which complete the implementation of a set of business objects which represent a product and a warehouse containing products.
The exercise contains a number of classes:
· The class ProductLevel represents a stock item and its stock level. This is a very simple class.
· The class WarehouseSolution represents the solution to the exercise. It represents a warehouse containing ProductLevel objects. Both this class and ProductLevel are business objects.
· The class ProductEnumeration is an Enumeration class which enables the products in the warehouse to be sequentially processed.
· The class TestClassSolution contains code used for executing our solution.
· The class Warehouse represents a warehouse containing products; it is the classthat you will be modifying to complete the development. You will need to modifythe findProduct() and findProducts() methods.
· The class TestClass is the class which is used to execute your solution. You should not have to modify this code.
Before carrying out the steps below you will need to set up the database that is required for the exercise.
The database, [url removed, login to view], is an access database and can be
It contains a single table ProductDetails which has nine
rows. Each row has two fields, the first is ProductName (the name of the product) which is a string and the second is ProductLevel (the stock level) which is an integer. Carry out the following steps to set up the database
1. Click Start|Settings|Control Panel
2. You will see an icon called Data Sources (ODBC), which sets up an ODBC data source within the control panel (sometimes it is located under “Administrative Tools”). This is a simple naming system which allows your Java programs to communicate with a Microsoft database. The name of the icon will be different on each Windows version, for example it will be marked ODBC Data Sources on NT4 and be found in a folder named Administrative tools and called Data Sources (ODBC) in Windows 2000. Double click this icon.
3. Click the add button on the window that appears.
4. On the next window double click the line starting Microsoft Access Driver.... A
new window should then appear.
5. In the new window enter the string "ProductDetails" into the field marked Data
Source Name. Then click the Select button.
6. Navigate to the location of the file containing the database. You will know that
you have reached it when the name of the file ([url removed, login to view]) appears in the leftmost text area. Select the file by clicking it and then click OK.
7. Get rid off all the windows that you have opened by clicking OK on all of them.
Do not click any other buttons.
8. The database file can now be referred to as ProductDetails within your Java
Now that the database is ready for access, carry out the following steps:
· Execute the code for TestClassSolution and examine the output.
· You should see the following: See Attached Word Doc named "SEE"
At this point you now have an operational database server system that can access a back
end database, which means you are now ready to address the academic portion of the assignment.
Perform the following:
Look at the classes that compose this system (e.g. Warehouse, ProductLevel,
TestClass, ProductEnumeration, etc.). Understand what they do from a client
server perspective. In particular understand the relationship between the business
objects and the underlying database.
· Modify the class Warehouse so that the code required is inserted.
· findProduct(): The first piece of code is new and requires you to create a ProductLevel object.
· findProducts(): The second piece of code replaces an existing return statement and requires you to program the returning of an Enumeration object.
· Execute the code for TestClass and examine the output.
· Check your results are the same as those obtained when running the solution.
1. Using the client server principles we have learned through the last couple of weeks (e.g. architecture, protocols, messages, databases, etc.), describe this system and it operations. You do not necessarily need to show the code used.
2. Create a three-tier application for an e-commerce bookstore application. Create a capability to select items based on user inputs. Show the architecture of your system supporting code.