Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having trouble with this one, and would appreciate some help, I have seen s

ID: 3531449 • Letter: I

Question

I am having trouble with this one, and would appreciate some help,

I have seen some examples how to do it but I am really puzzled as I am not that good with programming.

Please, but please, if you are willing to help me post the entire code = I WILL rate you good,

I have lost too much time on trying to work this one out.



Problem: Checking Account
+-----------------------+

This project involves a simple checking account problem that requires the
following specific tasks.

1. Customer deposits
2. Customer withdraw
3. Applying service fee
4. Getting current balance
5. ... Add other functionality as needed

A check account fields consists of these

1. First Name, Last Name
2. Account Number
3. Balance, which reflects the current amount at the account
4. Amount
5. Transaction, which could be deposit, withdraw, or charge
6. Date
7. ...

Requirements
+------------------------+
1. Use plain file as database to maintain the customer data. Each transaction
must be recorded into this file.

2. Print current balance after each five transaction.

3. Reading directly from input stream into Java data type is error prone.
For instance, if the data consists of a set of digits mixed with alphabet
while it was expected to be a pure number, the reading operation most
certainly will fail. One possible solution to this problem is writing a
filter which helps verify that the incoming data is the correct data type.
So, add filtering feature for your program.
4. You must use method for each task outlined above.

2. Use the data file provided to test your program. The exact copy of the
data is given below.

Id Date First Name Last Name Transaction Amount
----------------------------------------------------------------------
1024 01/01/2007 Charles Babbage deposit 32.00
1024 01/03/2007 Charles Babbage deposit 96.00
1024 01/10/2007 Charles Babbage deposit 16.00
1024 01/13/2007 Charles Babbage withdraw 96.00

1024 01/31/2007 Charles Babbage withdraw 32.00
1024 02/03/2007 Charles Babbage deposit 32.00
1024 02/07/2007 Charles Babbage deposit 96.00
1024 02/11/2007 Charles Babbage deposit 16.00
1024 02/17/2007 Charles Babbage withdraw 32.00

1024 03/01/2007 Charles Babbage deposit 32.00
1024 03/02/2007 Charles Babbage deposit 32.00
1024 03/04/2007 Charles Babbage deposit 32.00
1024 03/08/2007 Charles Babbage withdraw 32.00
1024 03/16/2007 Charles Babbage withdraw 32.00

Explanation / Answer

public class BankAccount

{

private String name;

private double balance = 100.00;


BankAccount(String s)

{

name = s;

}


public double getBalance()

{ return balance;}


public void withdraw(double d)

{ balance -= d;}


static class CheckingAccount extends BankAccount

{

private boolean overdraft;

private BankAccount bankAccount;


CheckingAccount(String x, boolean y)

{

super(x);

overdraft = y;

bankAccount = new BankAccount(x);

}


public boolean clearCheck(double x)

{

if (hasOverdraft() || x < bankAccount.getBalance())

{

bankAccount.withdraw(x);

return true;

}

else return false;

}


private boolean hasOverdraft()

{return overdraft;}


}


public static void main(String[] args)

{

CheckingAccount ck = new CheckingAccount("Blackcompe1", false);

System.out.println("Balance = "+ck.getBalance());

System.out.println("Clear Check for $120.00 ? "+ck.clearCheck(120.00));


CheckingAccount ck2 = new CheckingAccount("Blackcompe2", true);

System.out.println("Balance = "+ck2.getBalance());

System.out.println("Clear Check for $120.00 ? "+ck2.clearCheck(120.00));

}

}