首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
C++留学生编程辅导、讲解Mathematics程序、讲解c/c++编程 讲解数据库SQL|讲解SPSS
项目预算:
开发周期:
发布时间:
要求地区:
Problem Sheet 3
LM Advanced Mathematical Finance Module
Part B C++ Spring Term 2021
PROBLEM SHEET 3 SPRING TERM, PROGRAMMING IN C++ LECTURE 3
Of School of Mathematics, College of Engineering and Physical Sciences, University of
Birmingham
Due Wednesday 12
th MAY 2021, 23:59
Weighting 20% of Part B
INSTRUCTIONS FOR THE SUBMISSION
Submit your code on Canvas as zip:
Submit as a single zip file containing all code for the problem. The source files should compile without errors or warnings on Visual Studio 2019 as installed on the
clusters, and the resulting executables should run without problems. Using debug and x64 build options. You
do not have to submit the executable. You should comment you code and describe what each function does.
If you use another compiler other than Visual Studio, you should take your final code and compile it
on Visual Studio on the remote clusters. Unfortunately, different compilers follow slightly different rules, and even a small difference may cause the code
to fail on Visual Studio. The source code should also be well formatted. This means that opening and closing
brackets should be aligned in a readable way, and we will discuss such styles briefly in the lectures. Finally, the
programs you write should run in a self-explanatory way. If you are asked that the program provides some input,
it should first have some output on the command line telling the user what kind of input is required. For instance, if you are supposed to read in the price of a interest rate, do the following:
This way, a user of the program who does not know about the code knows what numbers one has to enter. You
may assume any user input will be correct and have no errors meeting the format requested. PLAGIARISM
Obviously, you are not allowed to plagiarise. This means that you are not allowed to directly copy the code from
any online sources or any of your fellow students. Direct group work is also not allowed. While you are allowed
(and even encouraged) to discuss the contents of this module (including problem sheets) with your fellow
students, every one of you needs to write your own code. PROBLEM 1 Create Time Series Share monitoring class in C++
Problem
In the analysis of time series data, filtering, the task of identifying and removing values, often needs to be carried
out in order to identify both short and long term trends. For instance, rolling average is commonly used with time
series data to smooth out short-term fluctuations and highlight longer-term trends or cycles. The first step toward
this is to implement this filtering in C++. In C++ transformations can straightforwardly be applied to the data
when it is stored in container data structures. This is a very common task, and tools to do so are provided by the
STL, which includes templated methods that execute common tasks, such as sorting and selection. The STL
double interest_rate;
std::cout << “ Please enter the interest rate: “ << std::endl;
std::cin >> interest_rate;
79ccb1e 1
algorithms for doing this can be applied to data stored in the STL containers such as std::vector, std::array and
std::list. You will create a class, TimeSeriesTransformations, which implements a several time-series
transformation operations. The class should be able to be used to perform common time-series transformations, such as adding or subtracting values to prices and removing undesired values. The algorithms necessary to
complete this task can all be accessed in your C++ code by including the Correct STL header file. For example: . We do not expect you in this task to implement any algorithms yourself.
Your programme must be able to read in a CSV file (the full file can be found on Canvas) containing time series
data, which contains a column with a timestamp stored in UNIX time (see Lecture 3), and a column of data
(floating point doubles) representing a share price labeled X like the following:
When you finish this problem, you should have:
Implemented a C++ class TimeSeriesTransformations.
Implemented a program that employs a TimeSeriesTransformations C++ class and functions. TimeSeriesTransformations
Your implementation of the TimeSeriesTransformations class must:
Have a constructor which can load a file given the filename (for e.g. “testdata.csv”) and store the time data
and the share prices internally. Have a constructor which can load the data into the class, where the input is given by two std::vectors
representing the time series and the share prices. Have functions mean and standardDeviation which compute the mean and standard deviations of the share
prices for the column of data. Have functions computeIncrementMean and computeIncrementStandardDeviation which compute the mean
and standard deviation of the increments (the difference between the share price on two consecutive
timestamps). Have a function appendPrice that takes a date and a value, and adds that at the end of the data. Have a function getTimestampsMatchingPrice that allows the user to filter the data by a share price value
and return all of the timestamps that the share price matches that. Have a function printEntriesOnDay that allows the user to filter the data by a calendar date and returns the
timestamps and prices on that day. Have a function removeEntryAtTime that allows the user to remove an entry by providing the timestamp. Your solution should utilise the remove_if template. Have a function removePricesEqualTo that allows the user to remove all entries matching a given value. Have a function removePricesGreaterThan that allows the user to remove all entries above a given value
(exclusive). Have a function removePricesLessThan that allows a user to remove all entries below a given value
(exclusive). Have a function printSharePricesOnDate that allow us to print all share prices a given day, and a function
printIncrementsOnDate that allows us to print all increments that occur on a given day. Have a function saveData that is able to write the data (including any new data) to a filename given by the
user.
This list is not exclusive - you may need to implement other functions in order for your class to function correctly. Program
TIMESTAMP,ShareX
1619120010,61.43814038
1619125010,58.74814841
1619130010,90.10017163
1619135010,100.5352112
1619140010,12.2706639
1619145010,50.17422982
1619150010,21.88813039
1619155010,91.20241001
1619160010,41.79297323
79ccb1e 2
To demonstrate that your class works you will need to implement a program which uses it, and which presents a
menu to the user. Initially, the user should be asked to enter a filename which contains the data. Then, menus
should be shown corresponding to those below (where appropriate):
Main Menu
** Expected Menu “Print all share prices on date” **
** Expected Menu “Add a share price” **
** Expected Menu for “Remove a share price” **
HINTS
There are lots of functions in the
header file which you can use:
In addition, other useful tools are found in the
header file:
Please Choose:
1. Print all share prices on a date
2. Print mean and standard deviation of prices
3. Print mean and standard deviation of price increments
4. Add a share price
5. Remove a share price
6. Filter share prices by date
7. Find greatest increment in prices
8. Save the data to file
Please enter date in the format YYYY/MM/DD
Please enter date and time in the format YYYY/MM/DD-HH:MM and the corresponding share price.
Please enter either:
1) Remove value at timestamp
2) Remove all prices above share value
3) Remove all prices below share value
4) Remove all prices equal to share value
copy, copy_backward,
for_each,
find_if,
count , count_if,
transform,
fill,
reverse,
sort,
binary_search,
min_element, max_element
bind,
plus,
minus,
greater_equal
79ccb1e 3
79ccb1e 4
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!