Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java, You will be building a Stock Portfolio Application that allows you to do transactions like buying and selling stocks and ability to deposit

In java, You will be building a Stock Portfolio Application that allows you to do transactions like buying and selling stocks and ability to deposit and withdraw cash from your brokerage account.
You will create a TransactionHistory class with the following attributes:
Private field Purpose of this field
String ticker Will store ticker of the Stock or CASH
String transDate Date when the transaction occurred
String transType Type of transaction BUY/SELL for stock, DEPOSIT/WITHDRAW for CASH
double qty Quantity for the transaction
double costBasis Cost Basis of stock. For CASH this will be 1.00
Create the constructor Default and Overloaded constructor
Getter and Setter methods for all the attributes.
You will create another class called PortfolioManager that will have the main method to test the application. This will have the following attributes
Private field Purpose of this field
ArrayList portfolioList = new ArrayList(); ArrayList to store any number of TransactionHistory records
You will create a menu for user to enter different types of transactions such as
DEPOSIT Cash
WITHDRAW Cash
BUY Stock
SELL stock
Create a menu as shown below to do the different types of transactions and display Transaction History and Portfolio Information.
Brokerage Account
0- Exit
1- Deposit Cash
2- Withdraw Cash
3- Buy Stock
4- Sell Stock
5- Display Transaction History
6- Display Portfolio
Enter option (0 to 6):
1. Buying and selling of stock DFEN after an initial deposit of $10000 CASH is made in the account. 100 stocks of DFEN are bought at $15 and later ALL the stocks are sold at $19, making a gain of $400 so the CASH in the portfolio increased $10400.00
The Transaction History will display
(first and lastname) Brokerage Account
======================================
Date Ticker Quantity Cost Basis Trans Type
==================================================================
7/1/2023 CASH 10000 $1.00 DEPOSIT
9/20/2023 DFEN 100 $15.00 BUY
9/20/2023 CASH -1500 $1.00 WITHDRAW
11/22/2023 DFEN 100 $19.00 SELL
11/22/2023 CASH 1900 $1.00 DEPOSIT
The Portfolio will display
Portfolio as of: 12/06/202315:38:16
====================================
Ticker Quantity
================
CASH 10400.00
Make a deposit of $10000 CASH into the account. Buy 100 stocks of DFEN at $15. Later, sell 50 stocks at $19, making a gain of $200 so the CASH in the portfolio increased $950. Then, buy 10 stocks of TSLA at $300. Finally, withdraw $2000 from the bank for some holiday gifts.
The Transaction History will display
(first and lastname) Brokerage Account
======================================
Date Ticker Quantity Cost Basis Trans Type
==================================================================
7/1/2023 CASH 10000 $1.00 DEPOSIT
9/20/2023 DFEN 100 $15.00 BUY
9/20/2023 CASH -1500 $1.00 WITHDRAW
10/22/2023 DFEN 50 $19.00 SELL
10/22/2023 CASH 950 $1.00 DEPOSIT
11/30/2023 TSLA 10 $300.00 BUY
11/30/2023 CASH -3000 $1.00 WITHDRAW
12/20/2023 CASH -2000 $1.00 WITHDRAW
The Portfolio will display
Portfolio as of: 12/25/202315:38:16
====================================
Ticker Quantity
================
CASH 4450.00
DFEN 50
TSLA 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Identify the components of risk management.

Answered: 1 week ago