Question: You are to write a GUI program that will allow a user to buy, sell and view stocks in a stock portfolio. This document will

You are to write a GUI program that will allow a user to buy, sell and view stocks in a stock portfolio. This document will describe the minimum expected functions for a grade of 90. Your mission is to go and do better. The meaning of do better is largely up to you. For example, you might track the profit or loss on the trades. You might allow for sales of partial holdings, or subsequent purchases to be added to an existing holding. Be creative.

Objectives

By the end of this project, the student will be able to

write a GUI program that maintains a cash balance, list of stock holdings, supports buying and selling of stocks and displays the current portfolio inventory

demonstrate the ability to assemble already-written classes into a larger, more complicated program

demonstrate the ability to segregate business logic from user interface code.

Capabilities

At a minimum, the program should

allow a user to buy a stock with a given number of shares and price per share.

display the current portfolio (stock ticker, number of shares, initial price).

update the portfolio display for purchases and sales.

allow the user to sell all of the shares of a given stock.

give the user an initial cash balance, and update and display the balance according to the user's purchases and sales.

ignore any transaction that causes the cash position to go below $0.

Sample Execution

The initial frame has text fields for the stock ticker, number of shares, and price per share. It has a label for the current cash balance. It also has buy and sell buttons.

You are to write a GUI program that will allow a user

Let's buy Apple (ticker AAPL) shares. First we enter the ticker, number of shares and price per share.

to buy, sell and view stocks in a stock portfolio. This document

Then we click Buy. Note our cash was reduced accordingly. Our portfolio inventory now displays since it's no longer empty.

will describe the minimum expected functions for a grade of 90. Your

Let's buy IBM. We enter the ticker, number of shares and price per share

mission is to go and do better. The meaning of do better

We click Buy. Our cash is reduced appropriately, our portfolio is updated. WidgetView moves things around. We won't worry about that. We also won't worry about the not-quite-right truncation of the last penny of the cash balance.is largely up to you. For example, you might track the profit

Let's buy Microsoft (MSFT). We'll just skip to the completed transaction.

or loss on the trades. You might allow for sales of partial

We're losing faith in IBM's CEO; let's sell it. We need to tell our portfolio manager which stock we want to sell, and the selling price per share. Since we're selling all of our shares, we don't need to fill in that field.holdings, or subsequent purchases to be added to an existing holding. Be

We click Sell, and the portfolio listing and cash are updatedcreative. Objectives By the end of this project, the student will be

Stoc Shares per Share Cash: 1000.0 Sell Buy Stoc Shares per Share Cash: 1000.0 Sell Buy

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!