Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Description For this assignment you will read and process historic stock data for the Tesla company. Project Setup and Structure Create a new java

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

General Description For this assignment you will read and process historic stock data for the Tesla company. Project Setup and Structure Create a new java project in Eclipse and call it homework01. Inside the src folder, create a new java package called hw01. o All of your source code files will need to be placed in the hw01 file. Inside the src folder, create a new folder called files. o Your .csv files should go in files. NOTE: When working with the .csv file, your program must use a relative path to the .csv file, NOT an absolute path. If you do not know the difference between the two, you will need to review on your own and do some research as to what these mean. o An absolute path will only work on your system, and will not work on my system. This means I will not be able to correctly execute your program and you will receive a O for the assignment. TeslaStock Class Create a class called TeslaStock. This class will be used to represent each stock's data in your project. This class should not contain any methods to read / write the data. Only implement the following in the class. This class should contain data fields for the date, opening price, low price, high price, and closing price of a stock. All data fields shall have the PRIVATE access modifier. o NOTE: Be sure to use the correct data types for each piece of data. Create getters and setters for each data field. Create appropriate constructors for this class. Implement the toString() method to display a TeslaStock object in the following format: . O Date: 2010-06-29 Opening Price: 3.8 High Price: 5.0 Low Price: 3.508 Closing Price: 4.778 No other methods are allowed. StockList Class This class will contain the methods necessary to display various information about the stock data. This class shall be a subclass of ArrayList. This class shall not contain any data fields. (You don't need them for this class if done correctly). This class shall have a default constructor with no parameters. o No other constructors are allowed. This class shall have the following public, non-static, methods: o printAllStocks: This method shall take no parameters and return nothing. This method should print each stock in the StockList to an output file. NOTE: This method shall NOT print the data to the console. The output file shall be called all stock_data.txt. The data should be printed in a nice and easy to read format. o displayFirstTenStocks: This method shall take no parameters and return nothing. This method should display only the first 10 stocks in the StockList in a nice and easy to read format. This method should display the data in the console. o displayLastTenStocks: . This method shall take no parameters and return nothing. This method should display only the last 10 stocks in the StockList in a nice and easy to read format. This method should display the data in the console. o computeAverageOpening Price: This method shall take no parameters and return a double value. This method should compute and return the average opening price of all stock data in the StockList. o computeAverageClosing Price: This method shall take no parameters and return a double value. This method should compute and return the average opening price of all stock data in the StockList. o findMaxHighPrice: This method shall take no parameters and return a single TeslaStock object. This method should compute and return the maximum high price of all the stock data. o find MinLowPrice: This method shall take no parameters and return a single TeslaStock object. This method should compute and return the minimum low price of all the stock data. No other methods are allowed or necessary. StockReader Class This class will contain the method necessary to read and parse the .csv file of stock information. This class shall contain a default constructor with no parameters. The constructor should be made private. o This is to prevent the class from being instantiated since the class will only contain static methods. This class shall contain no data fields. This class shall have a method called readStockData: o This method shall be a public, static, method. o This method shall return a StockList object once all data has been processed. o This method will take a File object as a parameter. This File object should link to the stock market data in your files folder created previously. o This method must validate that the given File object is a .csv file. If it is not, then this method shall throw an IllegalArgumentException. o This method shall read the File object and process all of the stock data into TeslaStock objects and store each object in a StockList. NOTE: The data must be parsed so each piece of data is correctly assigned to its respective data field in the TeslaStock class. NOTE: You will want to ignore the first line of data as this line contains the header labels for each column of data. No other methods are allowed. . method shall throw an IllegalArgumentException. o This method shall read the File object and process all of the stock data into TeslaStock objects and store each object in a StockList. NOTE: The data must be parsed so each piece of data is correctly assigned to its respective data field in the TeslaStock class. NOTE: You will want to ignore the first line of data as this line contains the header labels for each column of data. No other methods are allowed. Main Class This class shall be called Main and will contain your main() method. This class shall do the following: o Create a File object linked to your .csv file. NOTE: You do not need to ask the user for the name of the file, you can just hardcode the relative path name into your source code. NOTE: Remember to use a relative path and setup your project correctly. Otherwise I will not be able to run your program. o Read all the stock data from the file and obtain a Stock List object. o Execute each method from the StockList class and show the results of each method. NOTE: For the printAllStocks method, you can show that the file was correctly created and open it during your video presentation. o Be sure that your output is neatly formatted and not a jumbled mess. Presentation of output counts towards your grade

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions