Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IT 168 - Fall 2016
- Program 4
- Due Date: Monday, October 31, 11:55 pm
- Total Points: 50 programming points
- Problem:
- There is an investment strategy referred to as constant value investing. The principle is that you divide the money you have to invest into equal amounts and purchase several diversified stocks and a portion of it in cash. You keep approximately equal amounts in each of those stocks. When one of the stocks grows more than 15%, you will sell some of the stock in order to get the value back to near the original amount you invested. With the proceeds from the sale, your cash on hand will grow and it will be available to purchase stocks whenever they fall more than 15%. You will always sell after making gains and purchase (buy) after the stock falls.
- The program you are going to create will assist an investor in keeping track of their constant value portfolio. You will be able to see the value at any given time of the entire portfolio. You will have options of adding to a position (buying more of a chosen stock) and reducing a position.
- This program will make use of an external Java library. This is a JAR file that will be provided with instructions on how to install. This file will contain classes that can be called to retrieve stocks and equities information from Yahoo Finance. See the accompanying document that shows how to set up this library and use it in your application.
- Design:
- • The classes should be placed in a package with the name edu.ilstu.it168.ulid.program04
- • Non-application (driver) classes Portfolio and Stocks should have complete Javadoc comments for all custom methods. You do not need Javadoc comments for standard setter and getter methods.
- You will need to use the following classes for your program:
- Please refer to the UML diagrams provided here and the sample runs in order to understand how the program is to function.
- Stock
- -symbol : String
- -initialShares : int
- -currentShares : int
- -initialPrice : double
- -currentPrice : double
- -lastPurchaseDate : String
- -calcCurrentMarketValue() : double
- -calcInitialMarketValue() : double
- -changeCurrentShares(int numShares) : void
- Constructor containing all variables
- default constructor
- getter and setter methods for all instance variables
- Portfolio
- -stock1 : Stock
- -stock2 : Stock
- -stock3 : Stock
- -stock4 : Stock
- -cashBalance : double
- -displayPositions() : void
- -calcTotalAccountValue() : double
- -updateCurrentPrices() : void
- -editPosition() : void
- -toString() : String
- getter and setter methods for all instance variables
- Investor
- -firstName : String
- -lastName : String
- -streetAddress : String
- -city : String
- -state : String
- -zip : String
- -phone : String
- -calcCurrentMarketValue() : double
- -calcInitialMarketValue() : double
- -changeCurrentShares(int numShares) : void
- Constructor containing all variables
- default constructor
- getter and setter methods for all instance variables
- PortfolioDriver class
- This is the starting point for the application which is the only class to contain a main method. You will use the both the Portfolio class, the Stock class and the Investor class here.
- • For this program, the main methods core logic will involve a while loop that will present the menu of choices.
- • Create 4 instances of the Stock class by calling the constructors and passing the parameters to it to create 4 different stocks in your initial price paid. Those stocks can be any of your choosing. I am using AMZN, AAPL, FB, and TSLA. This portfolio manager is limited to managing 4 different stocks in your cash account balance. This user is investing approximately $10,000 in each of the 4 stocks and holding approximately $10,000 in cash. For an approximate portfolio total value of about $50,000.
- • Create an instance of Portfolio and pass objects created for the 4 stocks to be set as data type instance variables in the portfolio class.
- • Follow the sample interaction on what to display for prompts the navigation menu and flow of screen inputs and outputs. Primary choices in the navigation menu will be:
- o Edit a position
- o Update to current stock prices
- o Print and account statement
- o Quit
- • Review the sample runs of the program to determine how the interaction with the user should flow.
- Submission:
- Zip your .java source files for all of the classes together into a zip file. Name the zip file with your initials and Program 4. Example format: KS-Program4.zip
- In a separate document you should provide the pseudocode for the driver. Which will likely be named PortfolioDriver. You should create this document before you begin coding your program. Filename format: KS-Program4-Design.docx.
- You will lose points if these 2 files are not named properly and separated.
Advertisement
Add Comment
Please, Sign In to add comment