logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

In this program you will determine various statistics for a Dow Jones Industrial Average Stock. You are to read the stock history data for the last 1000 market days into arrays and then perform the calculations for various time period

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

The purpose of this assignment is to give you practice working with arrays, passing them to functions, and reading and writing text files.

In this program you will determine various statistics for a Dow Jones Industrial Average Stock. You are to read the stock history data for the last 1000 market days (approximately 4 years) into arrays and then perform the calculations for various time periods. Your are to create a report similar to the following

Sample Output

Stock:  CAT

Current Date: 2019-11-26 Current Close: $146.09

Market Days  Start Date  Open Price   Up Days  Down Days   Gain  Pct Gain         Max Close   Avg Close

-

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5

 

2019-11-20

 

142.45

 

2

 

3

3.64

 

2.56%

 

146.42

144.25

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10

 

2019-11-13

 

144.36

 

4

 

6

1.73

 

1.20%

 

146.42

144.13

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

20

 

2019-10-30

 

141.00

 

8

 

12

5.09

 

3.61%

 

148.16

144.61

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

50

 

2019-09-18

 

131.63

 

24

 

26

14.46

 

10.99%

 

148.16

134.85

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

100

 

2019-07-09

 

134.11

 

48

 

52

11.98

 

8.93%

 

148.16

130.46

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

200

 

2019-02-13

 

134.20

 

101

 

99

11.89

 

8.86%

 

148.16

131.83

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

500

 

2017-12-01

 

141.60

 

251

 

248

4.49

 

3.17%

 

170.89

138.85

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1000

 

2015-12-08

 

66.99

 

508

 

489

79.10

 

118.08%

 

170.89

115.69

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Output Details

Stock (example CAT) is stock ticker of a Dow Jones Industrial Average (DJIA) stock.

Current Date represents the most recent market date stored in the history file.

Current Close represents the most recent closing price for the current market date stored in the history file. Use the Close value for this, not the Adj Close.

Market Days represents a time period for analysis. For example, 1000 market days represents the last 1000 entries in the history file. The number of market days is inclusive. If the market days is 5 and the current date is 2019-11-27, then the last 5 market days are 2017-11-27, 2017-11-26, 2017-11-25, 2017-11-22, and 2017-11-21.

Start Date is the first date in a time span of the length indicated by the number of Market Days and ending with the Current Date.

Open Price is the opening price (Open) on the Start Date.

Up Days is the number of days in the time period in which the stock Close price is greater than the stock Open price. Down Days is the number of days in the time period in which the stock Close price is less than the stock Open price. Gain is the difference between the Current Close price and Open Price when time period starts.

Pct Gain is the percentage gain from the Open Price when time period starts and the Current Close price.

Max Close is the highest close that occurs during the time period for analysis.

Avg Close is the average close that occurs during the time period for analysis.

Sample Input File

Note that the input data is sorted from oldest to newest.

Program Requirements

  1. Use at least 4

  2. Use at least 3 named

  3. Use at least 3

  4. Use the current market data

  5. Your analysis must contain the 8 market date spans (5, 10, 20, 50, 100, 200, 500, and 1000 days) shown in the Sample Output above and

  6. Your analysis report must be written to a

  7. File opens must be checked

  8. Market dates must be stored in a (1000 element) string

  9. The report format must closely follow the sample output above. Dollar values, number alignment, percentage formats, and approximate spacing must be

  10. Use any one of the input files for test: csv      MSFT.csv                                                               WMT.csv

  11. Your program must use the original CSV input file. You may not modify the original input file outside of your

Note: your solution will be graded using another current input file of the same size.

Program Hints

There are many parts to this assignment. Break your solution down into pieces (functions), write and test each piece as you proceed. Start with reading in the history file. Make sure you are successful with that first, then proceed.

In the beginning, work with a small amount of data (maybe array sizes of 10), so that you can see that you are performing calculations correctly.

Don't worry about formatting the output until the end after you know you have all of the calculations are correct. Make sure you test as you proceed.

Suggestions

  1. Read in the input file and remove the

  2. Since the input date is recorded in the input file from oldest to newest, you may want to store the data backwards in the arrays.

  3. Write a function to calculate the number of up days for the time

  4. Write a function to calculate the number of down days for the time

  5. Write a function to determine the max close for the time

  6. Write a function to determine the average close for the time

Sample Output Files

 

5

 

2019-11-20

 

150.31

 

3

 

2

1.72

 

1.14%

 

152.03

 

150.39

10

 

2019-11-13

 

146.74

 

7

 

3

5.29

 

3.61%

 

152.03

 

149.80

20

 

2019-10-30

 

143.52

 

12

 

8

8.51

 

5.93%

 

152.03

 

147.31

50

 

2019-09-18

 

137.36

 

25

 

25

14.67

 

10.68%

 

152.03

 

142.23

100

 

2019-07-09

 

136.00

 

50

 

50

16.03

 

11.79%

 

152.03

 

139.78

200

 

2019-02-13

 

107.50

 

110

 

90

44.53

 

41.42%

 

152.03

 

131.42

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

596 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

942 Answers

Hire Me
expert
Husnain SaeedComputer science

844 Answers

Hire Me
expert
Atharva PatilComputer science

504 Answers

Hire Me
April
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30