Roman4525

Program 4

Oct 18th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. IT 168 - Fall 2016
  2.  
  3. Program 4
  4.  
  5. Due Date: Monday, October 31, 11:55 pm
  6. Total Points: 50 programming points
  7.  
  8. Problem:
  9. 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.
  10.  
  11. 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.
  12.  
  13. 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.
  14.  
  15. Design:
  16. • The classes should be placed in a package with the name edu.ilstu.it168.ulid.program04
  17. • 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.
  18.  
  19. You will need to use the following classes for your program:
  20.  
  21. Please refer to the UML diagrams provided here and the sample runs in order to understand how the program is to function.
  22.  
  23.  
  24. Stock
  25. -symbol : String
  26. -initialShares : int
  27. -currentShares : int
  28. -initialPrice : double
  29. -currentPrice : double
  30. -lastPurchaseDate : String
  31. -calcCurrentMarketValue() : double
  32. -calcInitialMarketValue() : double
  33. -changeCurrentShares(int numShares) : void
  34. Constructor containing all variables
  35. default constructor
  36. getter and setter methods for all instance variables
  37.  
  38. Portfolio
  39. -stock1 : Stock
  40. -stock2 : Stock
  41. -stock3 : Stock
  42. -stock4 : Stock
  43. -cashBalance : double
  44. -displayPositions() : void
  45. -calcTotalAccountValue() : double
  46. -updateCurrentPrices() : void
  47. -editPosition() : void
  48. -toString() : String
  49. getter and setter methods for all instance variables
  50.  
  51. Investor
  52. -firstName : String
  53. -lastName : String
  54. -streetAddress : String
  55. -city : String
  56. -state : String
  57. -zip : String
  58. -phone : String
  59. -calcCurrentMarketValue() : double
  60. -calcInitialMarketValue() : double
  61. -changeCurrentShares(int numShares) : void
  62. Constructor containing all variables
  63. default constructor
  64. getter and setter methods for all instance variables
  65.  
  66.  
  67. PortfolioDriver class
  68. 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.
  69. • For this program, the main methods core logic will involve a while loop that will present the menu of choices.
  70. • 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.
  71. • 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.
  72. • 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:
  73. o Edit a position
  74. o Update to current stock prices
  75. o Print and account statement
  76. o Quit
  77.  
  78. • Review the sample runs of the program to determine how the interaction with the user should flow.
  79.  
  80.  
  81. Submission:
  82.  
  83. 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
  84.  
  85. 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.
  86.  
  87. You will lose points if these 2 files are not named properly and separated.
Advertisement
Add Comment
Please, Sign In to add comment