Question
We will model a simplified version of investments. Use comments to clarify what your code is trying to do. Also in Java please! Ill thumbs
We will model a simplified version of investments. Use comments to clarify what your code is trying to do. Also in Java please! Ill thumbs up if the solution is good! I need it urgently!
A holding is an investment in a company, keeping track of how many shares are owned (It is possible to own fractional shares.). We also need to keep track of the current price per share. (if we own 10.5 shares and shares are worth $90 each, the total value is... )
We also need to know what percentage the company periodically pays out as a reward for holding shares, called a dividend. (If they pay 1%, they would give a $1 dividend on a holding whose total value was $100). Some holdings we might set to reinvest, which means that any dividend is automatically used to buy more shares of the same holding.
A Holding's shareprice may rise or fall, meaning that our shares are worth more or less. Each holding has certain percentage volatility, which controls the range their share price changes when updated. So if volatility is 10%, and the old price was 30, the new price would be random between 30-3 and 30+3.
We need to be able to use an amount of money to buy shares at the current price, sell a certain amount of money worth of shares at the current price (reducing how many shares we own but getting that money back out), and update the holding, which involves updating the share price and paying out or reinvesting a dividend.
When we buy or sell holdings, there are generally fees to pay.
Most investments just have a percentage to pay on each buy and a percentage to pay on each sell.
Some investments have an administrative fee instead, and a certain number of free transactions. After all the free transactions (buy or sell) are used up, the administrative fee is taken out on every transaction, (it could take the full amount of the transaction if this is less than the fee).
Any holding could use one of these and be converted from one to another while the program runs.
When buying, subtract the appropriate fees from the amount being bought before actually buying shares. So, if I try to buy $100 of a holding with a percentage scheme that takes 1% on buy, I will end up owning $99 worth in my holding.
When selling, subtract the full amount to sell out of from the shares, but then take out a fee before actually paying out the money. So if I own $500 of a Holding with a fee scheme with an admin fee of $1 that is out of free transactions, and I try to sell $100, I will end up still owning $400 worth, but only $99 will be paid out to the user. (If not out of free transactions, we'd get the full 100)
When your program runs, read in a list of holdings from a file (always the same file, make sure that when you turn in your work this file is at the top of your zipped project directory).
The user has options to add a new holding (whatever amount they specify, consider that they are buying that holding), remove a holding from the list (sell it and tell them how much they were paid), run a 5-year simulation on all current holdings, or quit (keep offering options until they quit).
A simulation lets the user see how their holdings might come out over time.
In the simulation, each holding updates each month.
If a holding has a total value of over $10000 after an update, upgrade it to $1 admin fees and 10 free transactions. (You don't have to check if it already had these characteristics.)
At the end of the simulation, sell all holdings, and then report how much the user made or lost (that is, compared to how much all the holdings were worth before the simulation). Dividends that weren't reinvested count as having been paid out to the user during the simulation and count toward how much they gained/lost.
At the end of the program, update and then save the current list of holdings to a file to be used the next time the program runs. The update before saving doesn't automatically upgrade fees for any holding, but the user should be told about any dividends that were paid out.
During a simulation we do not want to mess up our existing holdings; if the user does 10 runs of the simulation and that's all, they didn't actually change the holdings we want to save for next time at all. Only adding, removing, and the update at the end make lasting changes (hint: copies!)
hint: you don't need to worry if you know nothing about real-world investments, I'm looking for nothing beyond what is described explicitly here.
hint: dividends that are reinvested count as buying and we need to take out fees
hint: strategy pattern! strategy pattern! strategy pattern!
hint: you can require a clone method as part of an interface, the return type can be the interface type, so any class that implements it can match this requirement with its own clone method
hint: because you will be generating a lot of random numbers, don't be surprised if you sometimes get bizarrely big or small results from a simulation. I'm interested in your program structure, not your numbers.
hint: in general, separate your classes into a front end: ones that talk to the user (mostly a main, though you might have more than one) and a back end: classes representing components of the situation, which do not talk directly to the user
hint: List is serializable. Are your classes?
HINT: NO REALLY IT IS POSSIBLE TO OWN FRACTIONAL SHARES. You can buy $5 of something with a $20 share price and add .25 of a share to your holding. This is part of the assignment; don't decide you know better and change it; you will only make your life harder.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started