The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
C&O: Bank Account: a) Write a class to represent a bank account (called BankAccount.java). This should include the following: i. Three attributes as follows: an attribute called name for the name of the bank account holder of type String, an attribute called balance of type double and a unique accountID of type int. The first value for the account ID should be 100001 and all subsequent bank accounts IDs that are created should be a unique value, in increments of 1. ii. A constructor which takes two parameters, one for the name and one for the balance. The balance must be greater than 0 (use the setBalance(<…>) method in (vii) below to check the balance is valid. The constructor should also set the value of a unique accountID. iii. Getter and setter methods for the name and balance (getName(), setName(<…>), getBalance(), setBalance(<…>). iv. A method to make a deposit called deposit(<…>). The method should accept a double as a parameter and add the value to balance. v. A method to make a withdrawal called withdrawal(<…>). The method should accept a double and reduce the balance by this amount if the balance is large enough to do so. vi. A method called print() that prints the name, balance and accountID. b) Write a new class called TestBankAccount.java. In the main method i. Create a bank account for “Mary Bloggs” with an initial balance of €500 and create another bank account for “Joe Spot” with an initial balance of €1000. ii. Print Marys balance to the screen using the getBalance() method iii. Print the details of Joes account using the print() method iv. Make a deposit in Joes account using the deposit(<…>) method for €500 and print his account details account v. Print Marys account details using the print() method vi. Withdraw €600 from Marys account using the withdraw(…) method – what happens? vii. Withdraw €400 from Marys account using the withdraw(…) method. viii. Mary and Joe get married. Set Mary’s new name to “Mary Bloggs-Spot” using the setName(<…>) method and print her account details again using the print() method
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly