Essay Writer » Essay Blog » Stock trading program

Stock trading program

Click here for best Essay Writers.

In this assignment, you will be setting up a menu system for your project by creating code based on the associated elements from your original pseudocode/flowchart created in Module 1. The menu system will help you see where your program is going and what modules you may need to end up coding.

For this deliverable, we are going to be creating the menu(s) for the project so the user can navigate through the program. Think about how your program is going to look and go back and look at your pseudocode and/or flowchart from Module 1.

Your menu(s) process(es) should reflect what you have documented in your pseudocode or flowchart

Menu should be based on a stock-tracking program under construction for client, Stock Market Trading. The GUI (Graphical User Interface) application allows users to track their own customized account list of stock holdings. As the GUI will change over time, a program must be available that will provide database access independent of the GUI.

The GUI will provide access to information in the database to both the users and the admin. The information that is accessible through the GUI will include:

  • User information such as all user IDs, the first and last names of each, and whether or not each is an administrator.
  • Stock ID and stock name
  • The stock holdings of each user

Besides displaying the information, the interface should provide the users the ability to delete their stock holding and add their stock holding.With administrative rights, more information can be done and more manipulation can be done for the data in the tables. The admin can access all the users’ data, the users holding and also can add stock, users and holding s for the users, the administrator can also delete data from the database.

The database will have three tables, one for the users another for the stock and another for stock holdings.The user tables will have the following information: the user ID, first name, last name and an indicator (Boolean variable) of whether or not the user is an admin or not. For this table, the user ID will be used as the primary key as it is unique for each user.The stock table will have only two fields. The symbol and the name of the stock. Since the symbol is unique, it will be used as the primary key in the table. The stock holdings table will have a user ID and the stock ID which correlates to the stock held by a particular user.To access the data in the database through the GUI, routines will have to be written to perform the following operations:

  • Populate the tables of the database with information for each of the fields.
  • Retrieve the data from the database to view in the GUI
  • Update the database and perform such functions as deletion

This operation can be done using SQL which is the most popular database environment. The pseudocode for this will be based on SQL databases.

Populating the database

The admin will enter data to the database through a form in the GUI. To pass this data to the tables, a backend program will be written to add the data to the database.For the user’s database the pseudocode for adding data for the various fields will be:

INSERT into users table (ID, first name, last name, and administrative status) – the parameters entered in the bracket are the actual values to be entered into the database. The administrative status is either true or false.

For the stock table the pseudocode for adding the data will be:

INSERT into the stock table (stock symbol, stock name) – the parameters in the brackets are to be replaced with actual values.

For the stock holding table, the pseudocode for adding data into the table is:

INSERT into stock holding table user ID and stock symbol.

Only the stock holding table can be populated by user’s who do not have administrative privileges.

Retrieving data from the database

Click here for best Essay Writers.

To display data, the data will have to be extracted from the database. The database query will return the data structured as arrays, and the data can be passed on to the GUI as tables or another format depending on the platform to be used. To retrieve the data from user’s table, the following pseudocode will be used.

SELECT first name, last name, and administrative status FROM user’s table where user ID = User1.

User1, in this case, is an arbitrary user ID, the user ID will be entered through the GUI and passed as a variable to the routine used to fetch the data required.

To retrieve stock name given stock ID, the following pseudocode shows how the routine will work:

“Select stock name from stock table where stock id is = XXX,” in this case as in the former; the stock ID is passed to the program as a variable from the GUI. Just as is done for the two tables above, the pseudocode for the code to retrieve stock for a given user ID from the stock holding table may be written as:

Select stock name from stock holding table where user id = User1

To obtain more information such as stock name not available in the stock holding table, the stock table is joined to the stock holding table.

Updating the database

To delete the data from the database the user may be logged in as a regular user or as an administrator. A regular user can delete their stock holding by deleting the stock ID associated with their user ID in the stock holding table. Their user ID, e.g., User1 is apposed as a variable to the program and it may be executed as:

Delete stock1 from stock holding table where user ID= User1.

A similar routine when the administrator wants to delete the stock only, in this case, the stock is deleted from the stock table instead of the stock holding table.

To delete stock where there is no stock holding, a program may be written which when a stock holding is deleted, checks is there is any other similar stock in the stock holding table, if there is none, the program deletes the stock from the stock table.

After deletion select stock three from stock holding table

If null

Delete stock three from stock holding table


Do nothing.

These are the pseudocodes for the basic routines that will be used to provide a link between the front end –GUI and the back end which is the database.

Click here for best Essay Writers.


Last Updated on April 25, 2020

Don`t copy text!
Scroll to Top