首页 > > 详细

C++ program 代码代编码讲解、辅导 C++ stock price 辅导Python编程|

Guideline of Assignment
Let us assume that you are an investor who holds a portfolio of stocks. You need to design a C++ program to maintain and manage stock price information of 7 days.
General Features and Functions
? Basic features: the program should be able to
1) Store the portfolio information into a 2-dimentional array(N × 8) of String type. The first column of the array for stock code, and the rest columns for 7-day prices. You may declare the total number of stocks as a constant valued 10 (i.e., N = 10), and initialize the array by setting code to the string “NULL” and prices 0. Below is an exemplar portfolio with 2 stocks.

02800 31.25 32.5 33.7 33.2 35.8 35.1 30.7

03700 419.6 422.3 421.7 429.2 411.9 412.6 410.1

NULL 0 0 0 0 0 0 0

N NULL 0 0 0 0 0 0 0


NULL 0 0 0 0 0 0 0

2) Add a new stock into the portfolio to an available place (input: code and 7 prices). If no available space left (all rows are occupied), print the error message accordingly.
3) Retrieve a stock (Input: stock code). If found, display all 7 prices, and the lowest, highest, and average price.
4) Modify the price of a stock on a certain day (input: stock code, day and new price)
o Note that only a stock that exists in the portfolio can be changed.
5) Delete a stock (the whole record, including its prices; input: stock code)
o Note that only a stock that exists in the portfolio can be deleted.
6) Display the entire portfolio
7) Populate random values into the entire portfolio (for testing purpose)
o Stock code: a random 4-digit in the range of 1000-4999
o Price: a double number between [0, 100), in the format of, for example, 28.3. Note that it is saved as a string in the array

? Bonus features
8) User input validation: check if user input is valid and prompt if not (e.g., a valid price)
9) Feel free to add any other relevant features to your system
? Hints
- User interface and features
o See an exemplar interface as in the given sample code (SampleUserInterface.cpp)
o For your reference, see an exemplar system coded by me, run the file “PortfolioManager.exe” to try my demo program. Note that other files in the same package are supporting library files that should be put in the same folder as the .exe file).
o However, feel comfortable to design an interface that you prefer, either simplified or feature-richer.
- How to cast between string, double, and integer
o see the given sample code “StringSampleCode.cpp”
- How to format a number-like string
o see the given sample code “StringSampleCode.cpp”
- How to validate user input
o see the given sample code “StringSampleCode.cpp”



联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!