public class BankAccount
{
//INSTANCE VARIABLES
public double balance;
public
String firstName;
public
String lastName;
//CONSTRUCTOR
public BankAccount(String
fn, String ln)
{
balance =
0.0;
firstName = fn;
lastName = ln;
}
//INSTANCE METHODS
public void deposit(double amount)
{
balance = balance + amount;
}
public void withdraw(double amount)
{
balance = balance - amount;
}
public
String fullName()
{
return firstName + "
" + lastName;
}
public boolean inOverDraft()
{
if (balance
< 0)
return true;
else
return false;
}
public
String toString()
{
return fullName()
+ "($" + balance + ")";
}
}
|