Question
Can you please write a code which stimulate the buying stocks resulting in the following output in the file in C++? Can't use array, public
Can you please write a code which stimulate the buying stocks resulting in the following output in the file in C++?
Can't use array, public data members like Class.
The input for account number has to be digits and 8 letter long.
3 tries for the wrong account number input.
you can use string / stringsream to format and keep track the data by string concatenation.
You need at least 5 functions for the code.
C:\>BuyStocks Please enter the 8-digit account number: 12345678
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 2
Number of purchases: 0 Purchase total: $0.00
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 1
Please enter the company name: IBM Please enter the number of shares: 100 Please enter the share's price: 150 100 shares of IBM at $150.00 per share. Transaction cost: $10.00. Total: $15010.00.
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 2
List of all purchases: 100 shares of IBM at $150.00 per share. Transaction cost: $10.00. Total: $15010.00.
Number of purchases: 1 Purchase total: $15010.00
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 1
Please enter the company name: Facebook Please enter the number of shares: 1000 Please enter the share's price: 142 1000 shares of Facebook at $142.00 per share. Transaction cost: $0.00. Total: $142000.00.
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 2
List of all purchases: 100 shares of IBM at $150.00 per share. Transaction cost: $10.00. Total: $15010.00. 1000 shares of Facebook at $142.00 per share. Transaction cost: $0.00. Total: $142000.00.
Number of purchases: 2 Purchase total: $157010.00
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 1
Please enter the company name: Intel Please enter the number of shares: 1 Please enter the share's price: 35.2 1 shares of Intel at $35.20 per share. Transaction cost: $10.00. Total: $45.20.
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 2
List of all purchases: 100 shares of IBM at $150.00 per share. Transaction cost: $10.00. Total: $15010.00. 1000 shares of Facebook at $142.00 per share. Transaction cost: $0.00. Total: $142000.00. 1 shares of Intel at $35.20 per share. Transaction cost: $10.00. Total: $45.20.
Number of purchases: 3 Purchase total: $157055.20
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 1
Please enter the company name: Yahoo Please enter the number of shares: 1100 Please enter the share's price: 27 1100 shares of Yahoo at $27.00 per share. Transaction cost: $0.00. Total: $29700.00.
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 2
List of all purchases: 100 shares of IBM at $150.00 per share. Transaction cost: $10.00. Total: $15010.00. 1000 shares of Facebook at $142.00 per share. Transaction cost: $0.00. Total: $142000.00. 1 shares of Intel at $35.20 per share. Transaction cost: $10.00. Total: $45.20. 1100 shares of Yahoo at $27.00 per share. Transaction cost: $0.00. Total: $29700.00.
Number of purchases: 4 Purchase total: $186755.20
Stock Trading Menu: 1. Buy 2. Report 3. Exit Enter your option: 3
Thank you for using our program.
C:\>
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