Answered step by step
Verified Expert Solution
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 BUYSELL for stock, DEPOSITWITHDRAW for CASH
double qty Quantity for the transaction
double costBasis Cost Basis of stock. For CASH this will be
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
Exit
Deposit Cash
Withdraw Cash
Buy Stock
Sell Stock
Display Transaction History
Display Portfolio
Enter option to :
Buying and selling of stock DFEN after an initial deposit of $ CASH is made in the account. stocks of DFEN are bought at $ and later ALL the stocks are sold at $ making a gain of $ so the CASH in the portfolio increased $
The Transaction History will display
first and lastname Brokerage Account
Date Ticker Quantity Cost Basis Trans Type
CASH $ DEPOSIT
DFEN $ BUY
CASH $ WITHDRAW
DFEN $ SELL
CASH $ DEPOSIT
The Portfolio will display
Portfolio as of: ::
Ticker Quantity
CASH
Make a deposit of $ CASH into the account. Buy stocks of DFEN at $ Later, sell stocks at $ making a gain of $ so the CASH in the portfolio increased $ Then, buy stocks of TSLA at $ Finally, withdraw $ from the bank for some holiday gifts.
The Transaction History will display
first and lastname Brokerage Account
Date Ticker Quantity Cost Basis Trans Type
CASH $ DEPOSIT
DFEN $ BUY
CASH $ WITHDRAW
DFEN $ SELL
CASH $ DEPOSIT
TSLA $ BUY
CASH $ WITHDRAW
CASH $ WITHDRAW
The Portfolio will display
Portfolio as of: ::
Ticker Quantity
CASH
DFEN
TSLA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started