Java - Bank Account Program
**Disclaimer: This must be unique. I know there are solutions for this already posted on the site, but they fail the originality check tremendously. **
Create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two constructors, as follows:
public BankAccount(String name, double balance)
throws NegativeAmountException
{
// set name and balance
// make sure balance is not negative
// throw exception if balance is negative
}
public BankAccount(String name)
throws NegativeAmountException
{
// set name and use 0 balance
}
As can be seen, the first constructor throws a NegativeAmountException if the balance being used to create the bank account is negative. You will have to create this exception class yourself.
The BankAccount class should also contain methods to make a deposit, make a withdrawal, get the current balance, and print a bank account statement. The interfaces for these methods should appear as follows:
// update balance by adding deposit amount