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

848 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

847 Answers

Hire Me
expert
Husnain SaeedComputer science

601 Answers

Hire Me
expert
Atharva PatilComputer science

609 Answers

Hire Me