联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-04-30 01:30

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.

0280031.2532.533.733.235.835.130.7

03700419.6422.3421.7429.2411.9412.6410.1

NULL0000000

NNULL0000000

NULL0000000

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)

oNote 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)

oNote 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)

oStock code: a random 4-digit in the range of 1000-4999

oPrice: 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

oSee an exemplar interface as in the given sample code (SampleUserInterface.cpp)

oFor 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).

oHowever, feel comfortable to design an interface that you prefer, either simplified or feature-richer.

-How to cast between string, double, and integer

osee the given sample code “StringSampleCode.cpp”

-How to format a number-like string

osee the given sample code “StringSampleCode.cpp”

-How to validate user input

osee the given sample code “StringSampleCode.cpp”




版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp