Question: using Java You are to write a GUI program that will allow a user to buy, sell and view stocks in a stock portfolio. This
using Java 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. Let's buy Apple (ticker AAPL) shares. First we enter the ticker, number of shares and price per share. Then we click Buy. Note our cash was reduced accordingly. Our portfolio inventory now displays since it's no longer empty. Let's buy IBM. We enter the ticker, number of shares and price per share. 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. Let's buy Microsoft (MSFT). We'll just skip to the completed transaction.We click Sell, and the portfolio listing and cash are updated
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
