Question: Java Programming Assignment 5 The Stock Picker The Stock Market is the perfect place for programs. Crunching a large volume of data is what software
Java Programming Assignment 5 The Stock Picker
The Stock Market is the perfect place for programs. Crunching a large volume of data is what software was built to do. In fact, 7580% of trades today are all automated orders that originate through software programs. This is where searching and sorting algorithms can really show their strengths. For this assignment, well look at Javas searching and sorting mechanisms as a means of wrangling all this data together (and maybe make a little money, too!).
Program requirements:
First, download the most recent daily stock data for the New York Exchange from the following site: (comment for URL)
You will need to create a new account. When you get access, click on Home Download. There are quick links for the latest files. Your download should either be a .txt or .csv file
When you open your file, you will see a list of stocks and numbers, separated by commas. They are in the following format: Stock Symbol, Date, Open, High, Low, Close, Volume
Create a new class called StockTracker
Create a new class called Stock. It should have methods and variables to handle all six stock fields mentioned above, e.g., getHigh(), getLow(), etc). Use appropriate Object-Oriented design.
Create a new ArrayList of Stock objects
Read in the stocks text file and parse by commas. You can use the String.split() method to break apart each line around the comma punctuation and then put it in an array
For each line, create a new Stock object and assign it the parsed values from the temporary array
Utilize Javas search and sort methods to answer and print the following queries:
o What is the stock with the highest opening price that day?
o What is the stock with the lowest opening price that day?
o List the top five stocks with the highest highs
o List the bottom five stocks with the lowest lows
o How did the following stocks perform? Disney (DIS) General Electric (GE) Wal-Mart (WMT) Coca-Cola (KO) Time Warner (TWX)
o Which stock had the highest volume that day?
o Which stock had the lowest volume that day?
Note: since these are custom objects, we cant simply call sort() without a Comparator. Furthermore, each object will have multiple fields to sort by. To set up a Comparator, use syntax such as this:
Comparator compareByVolume = (Stock s1, Stock s2) -> s1.getVolume().compareTo( s2.getVolume() );
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
