top of page

Bulls and Bears: Java Application that will track Historical Stock Data



Objectives:

  1. Read input data from an external file

  2. Develop an interactive application plotting external data

  3. Display statistical summary information


Project Structure / Grading:

Because the Projects are a chance for you to demonstrate what you've learned, they will be structured differently in that:


  • You may not discuss this project with any other student. TA's will only answer questions related to syntax issues. All other questions must be directed to the instructor. No help will be available within 24 hours of the due date/time – please plan ahead.

  • The project will have 3 parts:

* Part 1 (74% of the score) will have requirements similar to the homework

* Part 2 (14% of the score) will require you to apply the techniques you've

learned so far in homework with somewhat less structure

* Part 3 (12% of the score) will require you to stretch a little beyond what

you've done so far

  • If Part 1 earns fewer than 80% of its possible points (fewer than 60 of the 74 possible), then Part 2 will not be graded at all. Similarly if Part 2 earns fewer than 12 points (of the 14 possible), then Part 3 will not be graded at all.

* NOTE: This means that it will be far better to complete Part 1 correctly,

rather than complete a little bit of each of the parts with lots of errors in each.

  • Any project submitted with compiler error will receive a 0 – please don't hand in code that doesn't compile

Description:

You decide to create a Java application that will help you track historical stock data. You realize quickly that keying in historical data can be quite tedious; therefore you turn your attention to the use of external data files for help. Fortunately there are PLENTY of websites available that can generate these external files for you. Please see separate document describing how and where to get your files. In this exercise, you'll write this application to read in the data from a file and then provide statistics on that data both on the console and through a graphic representation.


Part 1

1. Start a new Eclipse Java Project and create four packages:


edu.westga.cs6312.stock.model

edu.westga.cs6312.stock.view

edu.westga.cs6312.stock.controller


Don't forget to include appropriately named testing packages too.


2. Inside the model package, define:

A class called StockRecord. This class will keep up with information about a

particular stock on a given day.


A class called StockManager. This class will keep up with one or more historical

records about a particular stock.


3. Inside the testing package, be sure to write JUnit test methods for each accessor method in the model classes to confirm that the class is functioning correctly.


4. Inside the view package, create a class called StockTUI. This class will declare ONLY instance variables for:

Instance Variables (only):

  • StockManager object

  • Scanner object

Methods:

  • A 1‐parameter constructor that accepts an object of type StockManager to be stored in the instance variable

  • A method named displayMenu. This method will display the following numbered list of menu options to the screen:

  1. – View summary data

  2. – View statistical data

  3. – View all records

  4. - Quit


Option #1 (Summary Data) will include the first, middle, and last record values.


Option #2 (Statistical Data) will include the maximum, minimum, and average closing prices only


Option #3 (All Records) will show all records in the collection, one per line.


A method:

private int getUserInt(String message)


This method will accept a String parameter which contains a message to be printed to the user describing what number to enter. The body of this method will continually do the following until an integer value has been entered:

  • Print the message to the screen

  • Read in the user's input as a String

  • Attempt to convert the input to an int


If the user enters something that's not an integer value, then a friendly message should be displayed to tell them that the input was not valid. It should then display the original message, read in a String, and attempt to convert that String into an integer. Only when the user enters an integer value should that number be returned from this method.

  • A method named run. This method will be responsible for directing the user interface for the application.

  • Other single‐purpose methods, as appropriate to meet the functionality needs of the TUI

5. In the controller package, define:

A class called FileInteractor that contains no instance variables and one method:

public static StockManager readData(String fileName)  

This method will open the file specified by the parameter, read the data, and use that data to populate a StockManager object to be returned.


Note: If there is a problem reading one of the lines of input, be sure to skip that line and continue reading (as subsequent lines may be valid).


A class called VersionChooser that contains:

Instance Variables (only):

  • Scanner object

  • A StockManager object

Methods:

  • A 0‐parameter constructor used to set up the Scanner instance variable

  • A void method named chooseVersion that accepts no parameters. For now, just have this method call getFileName, FileInteractor.readData, and runTextOption (this will change in Part 2)

  • A private void method named runTextOption that accepts no parameters. This method should create a StockTUI object using the StockManager instance variable and call run.

  • A method:

private String getFileName() 

This method will use the console to prompt the user for a file to be read and

return that filename.


6. Finally, in the controller package and define a class named StockDriver. This class will create an instance of VersionChooser and use it to call chooseVersion. When all methods are written and all tests pass, close Eclipse, and Zip the folder holding your Eclipse project using 7‐Zip. Give your file the name CS6312YourLastNameFinalPart1.zip. Upload the Zip file to the appropriate link in Moodle


As always, you should use meaningful identifier names, appropriate comments (including documentation strings), appropriate methods, and appropriate indenting in your code – your code should at a minimum pass Checkstyle (any issues listed in the Problems tab will result in loss of all Style points). Also be sure that you are committing your changes and making notes about those changes in your ChangeLog.



If you need solution of above problem then send your requirement details at realcode4you@gmail.com and get instant help with an affordable price.

We are also providing:

  • Java Homework Help

  • Java Project Help

  • Java Coding Help

  • Java Assignment Help

  • JavaFx Project Help

  • Spring Boot Project Help

Comments


bottom of page