Start with BankAccount
- Create a subClass of BankAccount called FreeChecking which gives no Interest. It will keep track of check number (starting at 1001). It will have a method writeCheck which will be like withdrawl, but take in a name of who the check is to and amount. It will also increment check number. Have it print out Check 1005 sent to Don Murphy for $500.
- Create a subClass of SavingsAccount called CDDeposit that works like a CD deposit
account. This does not allow for withdrawls (if they try to withdrawl
- have it system out - sorry you cant withdrawl from a CD account).
- Add another subClass of BankAccount called StockMarketAccount that will allow
the user to keep track of one stock.
- It will extend Account with the same functionality.
- They will need to store the stock's name, price, and quantity of that stock that they own. Ie "GE" $42 each stock and they have 20 issues of that stock. The constructor will also take in this info (along with name, balance).
- Their toString will be the same information as before, plus
info about the stock they have.
- It also will include methods to addStocks(int numOfStock). This will transfer
money from the account to to issue of stock). So if they had $1000 in balance and buy 4 issues of stock with price $50. Their new balance is $800 plus 4 issues of stock $50. If they dont have enough money it prints out sorry you cant afford to purchase that much.
- sellStocks(int numOfStock) - this does the opposite. If they dont have enough stock, then it will print that out.
- updatePrice(double price) which changes price of stock.
Add to BankingSystem:
FreeChecking acct3=new FreeChecking("Jacob",500);
System.out.println(acct3);
acct3.writeCheck ("Don Murphy",45.55);
acct3.writeCheck ("Peter Pan",52);
System.out.println(acct3);
BankAcct acct4=new CDDeposit("Jacob",500);
System.out.println(acct4);
acct4.withdrawl(500);
System.out.println(acct4);//should be the same as above
//this would create jims account with a balance of $500 and having 4 issues of IBM stock at $35.50 each
StockMarketAccount acct5 = new StockMarketAccount ("Jim", 5000, "IBM", 35.50, 4);
System.out.println(acct5);
acct5.addStocks(5);
acct5.updatePrice(42.00);
System.out.println(acct5);
acct5.sellStocks(2);
System.out.println(acct5);
|