due December 2nd
Note: changes 11/27, sample output corrected 11/28 10:30 am
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.
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 |
Date,Open,High,Low,Close,Adj Close,Volume 2015-12-08,66.989998,67.160004,66.180000,66.540001,58.241219,6866300 2015-12-09,66.300003,67.019997,65.160004,65.910004,57.689789,8578000 2015-12-10,65.980003,67.089996,65.910004,66.379997,58.101162,5768700 2015-12-11,65.379997,66.099998,64.480003,65.430000,57.269665,7572600 2015-12-14,65.629997,66.180000,64.730003,66.120003,57.873596,7371100 2015-12-15,65.459999,66.959999,65.239998,66.750000,58.425026,6061200 2015-12-16,66.220001,67.879997,66.139999,67.720001,59.274048,6747600 2015-12-17,67.180000,67.510002,64.879997,64.900002,56.805748,6800000 2015-12-18,64.599998,65.870003,64.099998,65.110001,56.989555,13490900 2015-12-21,65.589996,65.820000,64.379997,65.239998,57.103352,5311500 2015-12-22,66.250000,68.790001,66.110001,68.410004,59.878002,9697200 ... |
Stock: MSFT Current Date: 2019-11-26 Current Close: $152.03 Market Days Start Date Open Price Up Days Down Days Gain Pct Gain Max Close Avg Close ----------- ---------- ---------- ------- --------- ---- -------- --------- --------- 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 500 2017-12-01 83.60 268 230 68.43 81.85% 152.03 112.74 1000 2015-12-08 55.47 534 459 96.56 174.08% 152.03 87.61 |
Stock: WMT Current Date: 2019-11-26 Current Close: $119.19 Market Days Start Date Open Price Up Days Down Days Gain Pct Gain Max Close Avg Close ----------- ---------- ---------- ------- --------- ---- -------- --------- --------- 5 2019-11-20 120.21 2 3 -1.02 -0.85% 119.86 119.29 10 2019-11-13 119.16 4 6 0.03 0.03% 120.98 119.71 20 2019-10-30 117.18 9 11 2.01 1.72% 120.98 119.19 50 2019-09-18 116.91 25 24 2.28 1.95% 120.98 118.75 100 2019-07-09 112.89 47 50 6.30 5.58% 120.98 115.64 200 2019-02-13 97.30 101 96 21.89 22.50% 120.98 108.96 500 2017-12-01 97.61 251 245 21.58 22.11% 120.98 99.42 1000 2015-12-08 60.07 530 461 59.12 98.42% 120.98 86.12 |