Programming Assignment #2 Solution




Write a Java program to compute the Dow Jones Industrial Average (DJIA) on the UNIX subsystem of z/OS. Your program must compute the average for the previous trading day’s closing price. The stocks that constitute DJIA are decided by the editorial board of the Wall Street Journal (WSJ). As of now, there are 30 company stocks and their symbols are AXP, AAPL, BA, CAT, CVX, CSCO, KO, DIS, DWDP, XOM, GE, GS, HD, IBM, INTC, JNJ, JPM, MCD, MRK, MMM, MSFT, NKE, PFE, PG, TRV, UTX, UNH, VZ, V, WMT.

The average is calculated as the sum of the price of the symbols divided by a constant. The value of the constant is setby the WSJ board which may change from time to time andits present (as of 2/10/18) value is 0.14602128057775.

Your program must read the stock symbols from a text file named‘ticker.txt’.

You must implement a class called ‘DjiaAverage’to read iteratively the symbols

from the input text file, retrieve their prices and then compute the average, rounded to 2 decimal precision. Your output should be a line such as:

Djia =  24,601.27 For example, you will use the URL the chart for MSFT as a string.

Then you need to parse the string to get the previous trading day’s closing time price. Please note that the URL is good to extract a stock symbol data as of now. We are not surehow long the URL may provide the data because it is maintained by a for-profit company. Your documentation must include your name, date,and a brief description. You need to useIDz to copy and save your work (a java files and text input file) locally in a folder DJIA. Zip the folder and rename as your_last Please note that only .zip files will be graded. It is required thatyour code must run on the mainframe and that you use class the name and text file name as given above.

How to turn in your work:

(1)Click on 2018SP INTRO ENTERPRISE SYS (CS-3321-01)’

(2)Click on the left side item ‘Lessons->Assignments(Dropbox)->Assignment 2’.

(3)Then click on ‘Browse My Computer’ and point to the compressed file your_last, click open, and allow the server to upload your work, and

click ‘Submit’ button. After that you can preview your submission to make sure

that the intended file was turned in.

error: Content is protected !!