Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Account {
- protected double balance = 0;
- int acctNo;
- Random rand = new Random();
- public Account()
- {
- }
- public Account(double ebalance)
- {
- balance = ebalance;
- acctNo = rand.nextInt(10000);
- }
- public String toString()
- {
- return ("Account Number: " + acctNo + "\n" + "Balance: " + balance);
- }
- public double deposit(double amount)
- {
- balance = balance + amount;
- return balance;
- }
- public abstract double withdraw(double withdraw);
- }
- public class CheckingAccount extends Account{
- int overDraftFee = 10;
- double balance;
- final double MINIMUMBALANCE = 100;
- public CheckingAccount()
- {
- }
- public CheckingAccount(double eDeposit)
- {
- super(eDeposit);
- }
- public double deposit(double aDeposit)
- {
- super.deposit(aDeposit);
- return balance;
- }
- public double withdraw(double withdraw)
- {
- balance = balance - withdraw;
- if (balance < 0)
- {
- System.out.println("You have overdrawn your account.");
- System.out.println("Overdraft fee is 10.00");
- balance= balance - overDraftFee;
- return balance;
- }
- else
- {
- return balance;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement