Question
You are working for a financial advisor who creates portfolios of financial securities for his clients.A portfolio is a conglomeration of various financial assets, such
You are working for a financial advisor who creates portfolios of financial securities for his clients.A portfolio is a conglomeration of various financial assets, such as stocks and bonds, that together write a balanced collection of investments.When the financial advisor makes a purchase of securities on behalf of a client, a single transaction can include multiple shares of stock or multiple bonds.
Generate an object-oriented application that will allow the financial advisor to maintain the portfolios for his/her clients.You will need to create several classes to maintain this information:Security, Stock, Bond, Portfolio, and Date.
The characteristics of stocks and bonds in a portfolio are shown below:
Stocks:Bonds:
Purchase date (Date)Purchase date (Date)
Purchase price (double)Purchase price (double)
Quantity purchased(int)Quantity purchased (int)
Ticker symbol (string)Issuer (string)
Par value (int)Face value (int)
Stock type (i.e. Common or Preferred) (enum)Stated interest rate (double)
Dividends per share (double)Maturity date (Date)
Several of the data members above require the use of dates. Strings will not be acceptable substitutes for date fields.
Generate an object-oriented application that will allow the financial advisor to maintain the portfolios for his/her clients.You will need to create several classes to maintain this information:Security, Stock, Bond, Portfolio, and Date.
The characteristics of stocks and bonds in a portfolio are shown below:
Stocks:Bonds:
Purchase date (Date)Purchase date (Date)
Purchase price (double)Purchase price (double)
Quantity purchased(int)Quantity purchased (int)
Ticker symbol (string)Issuer (string)
Par value (int)Face value (int)
Stock type (i.e. Common or Preferred) (enum)Stated interest rate (double)
Dividends per share (double)Maturity date (Date)
Several of the data members above require the use of dates. Strings will not be acceptable substitutes for date fields.
#pragma once
#include
#include
#include
class Date{
friend std::ostream& operator<<(std::ostream&, Date);
public:
Date(int d=0, int m=0, int yyyy=0) {
setDate(d, m, yyyy);
}
~Date() {}
void setDate(intd, int m, int yyyy){
day = d;
month = m;
year = yyyy;
}
private:
int day;
int month;
int year;
};
std::ostream& operator<<(std::ostream& output, Date d){
output << d.month << "/" << d.day << "/" << d.year;
return output;
}
Design a Portfolio class
The portfolio has a name data member.
The class contains a vector of Stock objects and a vector of Bond objects.
There is no limit to the number of Stock and Bond puchases that can be added to a portfolio.
The Portfolio class should support operations to purchase stocks for the portfolio, purchase bonds for the portfolio, or list all of the items in the portfolio (both stocks and bonds).
Main()
You should write main() program that creates a portfolio and presents a menu to the user that looks like this:
"S" should allow the user to record the purchase of some stocks and add the purchase to the Stocks list. Likewise, "B" should allow the user to record the purchase of some bonds and add the purchase to the Bonds list."L" should list all of the securities in the portfolio, first displaying all of the Stocks, sorted by ticker symbol, followed by all of the bonds, sorted by issuer.The user should be able to add stocks, add bonds, and list repeatedly until he or she selects "Q" to quit.
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