How do I do this ? It\'s in java. This project will be used to solve the problem
ID: 3769469 • Letter: H
Question
How do I do this ? It's in java.
This project will be used to solve the problem of gathering information about a person’s financial investments. Investments a person may have include stocks, mutual funds, and real estate. This program will be limited to gathering information about a person’s share assets: stock and mutual fund investments. The information about a share assets which would need to be known is: the symbol, number of shares owned, price paid per share, and the current price. There are stocks that pay dividends and those that do not. Stocks that pay a dividend would need the amount of dividends paid. The difference between a mutual fund and a stock is that a person can own parts of a share of a mutual fund, while entire shares of stock must be owned. (Hint: An OO concept applies here.) The user should be able to find out the current market value of an asset as well as the profit or loss of the asset. Design a program that keeps track of a person’s share assets. The program must meet the following requirements: 1. The project must use user defined classes and inheritance. 2. A GUI interface must be used for user I/O. 3. A person may own shares of multiple stocks as well as participate in multiple mutual funds. 4. A given stock asset object should only have information about one asset – stock, dividend stock, or mutual fund. 5. Exception handling must be used where appropriate. 6. The stock and mutual fund information (portfolio) must be stored in a text file. 7. The user should have the option to display the portfolio information contained in the text file.
Explanation / Answer
I hope you are well aware of OOP concepts like inheritence, overriding etc. Hence with respect to the given problem, you can proceed based on following tips:
1. First define a base class Stock with the following properties - symbol, no. of shares/units, purchase price, current price. The data type of "no. of shares/units" field should be integer as stock can not be held in parts. You will need to define corresponding getters/setters methods and other relevant methods like calculating the total investment value (no. of shares * purchase price), calculating current value of investment (no. of shares * current price), whether there is profit or loss (depending on the diff. of total investment value and total current value) and if any, then how much.
2. Next you will need to derive a class DividendStock from Stock. This class will have extra field to store information about dividend paid. Corresponding Method(s) in base class giving details of overall profit/loss will need to override to adjust the amount of dividend paid in overall profit/loss. You will also add getter/setter methods for the new field.
3. After this, you will also derive a class MutualFund from Stock class. Note here the data type of "no. of shares/units" field will need to be changed from integer to double as unit in a MF can also be held in parts. So you will need to override corresponding ,methods accordingly.
4. In last, define a class Portfolio specifying about the types of investments held by a person. In this class, you will include all three share assets as data members and set them accordingly. You will also write methods to calculate the overall portfolio value, store and display portfolio information etc.
5. Corresponding GUI can be created by using Java Swing framework. Hope you know how to use swing.
Hope these points will be helpful to you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.