Final Assignment

 

New! This is to restate the new requirement that says your site should allow one to login (thus a link is needed for this functionality) and that only a logged in user can use the stock quote service (i.e., the applet).

 

Points: 100

Due: ??/2000

What to turn in:

 

Turn in a disk with all the answers to this assignment. Also, since this is the last assignment (I know you will miss the fun of doing the labs/assignments J), I need you to also turn in the solutions to all the other labs/assignments that you have done since the beginning of the semester. I will keep this disk for record keeping purposes. You ought to also duplicate this disk so that you have a record of all the things that you have done for future reference. If you need blank disks, stop by my office and I’ll get you one.

 

Note that all files are to be put in their respective folders. That is, all files for lab x are to put in the folder A:\LABx,where x is the lab # and all files for assignment y are to be put in the folder A:\ASSIGNy, where y is the assignment #.

 

The Assignment

 

This is your last assignment for the semester! Recall that this is given in place of a course project. That is, instead of building a comprehensive web-related system, a requirement for a course project, you are merely asked to implement pieces of a project.

 

For this assignment, you are to consider a stock quote system where users can visit a web site, enter a stock symbol, and receive the current quote (i.e., price) for the stock in question.

 

Requirement #1 (40%)

 

You are to implement both the client and server sides of this system. When a stock symbol is transmitted to the server (by clicking, say, the GO! button), the server is to retrieve the price for the stock and returns it to the client for display. Stock symbol is a unique key, i.e., given a stock symbol one can uniquely identify its record and thus get the price. There will be no duplicates for a stock symbol.

 

The data that the server needs to read from is contained in a database table that is constantly being updated by another program (not your responsibility!). Your server needs to just retrieve the required data from the table and send it back to the client. Make appropriate assumptions about the details (e.g., port #). Note that since there is potentially a large collection of stocks, you do not want to sequentially enumerate the stocks one by one to figure out the price. Use SQL to lookup the specific stock of interest.

 

Also, to better serve the customers, you want to allow the customer to search for a company ticker symbol by providing the company name (i.e., a keyword). For example, the symbol MSFT is for Microsoft Inc., T for AT&T, INTC for Intel, etc. With a ticker symbol, a user can then use the lookup service discussed above. For simplicity, you may assume that there is only one company that corresponds to a keyword provided by the user (e.g., when “Micron” is provided for a company name, there is only one company that corresponds to Micron and the ticker symbol is MU). See below for bonus credits if you handle the possibility of multiple companies satisfying a keyword provided by a user.

 

Specifics:

 

  1. The client is to be implemented as an applet.
  2. The client must allow one to search for a symbol by providing a keyword for a company name and lookup a stock price by providing a symbol.
  3. The server is to be implemented as a Java application.
  4. The server is to search for a symbol and lookup a stock price by retrieving the necessary data from a database called SymbolDB (the data source name), implemented in Microsoft Access (the physical file name is TickerSymbol.mdb, available in T:\ACS368\Summer00.) See the database for specifics in table name, column names, etc.
  5. Bonus (10 points): In reality, when a keyword for a company name is provided, there is a possibility that multiple companies may match the keyword. For example, when “Micron” is provided for a company name, there can be more that one company that correspond to the keyword “Micron” (Micron Electronics, Micron Computers, etc.) and thus all the ticker symbols should be retrieved and returned.
  6. Bonus (5 points): If Swing component JTable is used to handle #5 above, i.e., display the results from searching for a keyword.

 

Requirement #2 (40%)

 

To help pay for this free lookup service of your site, you want the users to register with your site before they can start using the services your site provides. (Then, with the huge customer base, you can sell this service to another company and become a millionaire! J) Thus, you need to provide a page where user information is gathered and processed. For simplicity, all that you are required to do here is to gather the information provided and insert the information into a database. You do not need to implement the part where a customer is required to login before using the services. Also, you do not need to worry about validating data, allowing customers to edit their information, etc.

 

Specifics:

 

  1. You need to use an HTML form (called LFddddNewUser.html, where L = Lastname initial, F = Firstname initial, dddd = last 4 digits of SS#) for gathering the user information. The following items are to be gathered.

 

 

Note: Don’t worry about the uniqueness of User ID. Assume that it is magically taken care off J.

 

  1. A servlet (called LFddddAddUserServlet.html, where L = Lastname initial, F = Firstname initial, dddd = last 4 digits of SS#) is to be used to process the data submitted from the client. For form elements AgeGroup, SalaryRange, and TradeFrequency, use 1 for the first category, 2 for the second, etc. when storing the data into the database. As for Investment, since this element can potentially have multiple values, you need to simply concatenate the all the values checked with the delimeter “,” and put them in a string for storing purposes. (In ACS378, you will learn about the various strategies of handling situations like this.)

 

For example, a user with the input MyID, xyz123, female, < 30 years old, 25 – 50K, > 30 trades, Stocks and Mutual Funds will have the following row inserted into the database:

 

UserID

Password

Gender

AgeGroup

SalaryRange

TradeFrequency

Investment

MyID

xyz123

female

1

2

3

Stocks, Mutual Funds

 

  1. Again, for our convenience, a database called CustomerDB (the data source name), implemented in Microsoft Access (the physical file name is Customer.mdb, available in T:\ACS368\Summer00.) See the database for specifics in table name, column names, etc.

 

Requirement #3 (10%)

 

Create a Home Page for your site. From this homepage, one should be able to register to become a new user and to use the applet for the lookup services.

 

If you simply provide homepage with a link/button for requirement #1 and another link/button for requirement #2 (and nothing else), you will only get 5% for this (or similar) design. To get the full 10%, you need to at least provide a left “table of contents” frame and a right “main” frame for displaying the main contents. Anything more will earn you bonus credits of up to another 5%.

 

Miscellaneous Requirement (10%):

In this question, you are to list and document 5 common mistakes/difficulties that a student coming from 168/169 (i.e., with C as the main background) to a course like this (i.e., with Java being a major language of instruction) is likely to make/face. The idea here is that with such a list, students taking this (or similar) course next semester can be forewarned about the common mistakes/difficulties and possibly sidestep them along the way. As such, you are encouraged to go back to the early weeks of the semester and find those mistakes that you made. Do provide enough information in each of your items so that other students can read and understand them.

Below please find an example of an item in such a list. You are to follow the format given in the example when writing your list.

Transitioning From C to Java: Top 5 List of Common Mistakes

1.      Keep forgetting that when a method is called, it is called on behalf of an object (or a class if the method is static). A method is never called as a standalone piece of code.

Example 1: Assume that Student is a class and that it has a print() method that prints the contents of an object.

Student s = new Student();
...
print(s); // Wrong! This is the "C" way of calling function.
s.print(); // Correct. When print is called, it is applied to the object s. Thus, the contents of s is printed.
              // This answers the question of "If print() doesn't take any argument, whose contents is it going to print?"

Example 2: Assume that Fraction is a class and that it has an add() method that adds two fraction objects.

Fraction f1 = new Fraction(1,2); // initialized f1 to 1/2
Fraction f2 = new Fraction(2,3); // // initialized f1 to 2/3
Fraction f3 = new Fraction();
f3 = add(f1,f2); // Wrong! This is the "C" way of calling function.
f3 = f1.add(f2); // Correct. Here, add() is applied to f1 and f1 is to add the argument f2
                        //  to itself and return another fraction object as the result.