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

**Please Read the requirements** I need help revising a program I wrote: 1) **Th

ID: 3826438 • Letter: #

Question

**Please Read the requirements**

I need help revising a program I wrote:

1) **There is an Error on:

transactions.add(new Trans(Trans.TRANSTYPE[0],amount,balance)); }

2)**There is an Error on:

z.opened = new Date(opened);

3)**There is an Error on:

BankAccountDriver.Java

BankAccount s1 = new BankAccount(10, rohan", 500);"

____________________________________

Bankaccount.java

*/

import java.util.ArrayList;

public class BankAccount

{

            private static double INT_RATE = 10.0;

           

           

            //This is used to Storee Account Number

            private int accountNo;

            // This is used to Store Account Holder's Name

            private String accountName;

            // This is used to stores balance of the account

            private double balance;

            // Store OverDraft Limit

    private double overdraftLimit;

            // This is used to store the date that the account was opened on

            private Date opened;

            // Store a list of Transactions

            private ArrayList transactions;

           

            // ******* MEMBER METHODS *******

//constructor

    public BankAccount()

            {

                        accountNo = 0;

                        accountName = "Empty";

                        balance = 0.0;

        overdraftLimit = 0;

                        opened = new Date();

                        transactions = new ArrayList();

                        transactions.add(new Trans(Trans.TRANSTYPE[4],0.0,0.0));

            }

           

            // This is called COPY CONSTRUCTOR

    public BankAccount(BankAccount p)

    {

        accountNo = p.accNo;

        accountName = p.accName;

        balance = p.balance;

        overdraftLimit = p.odLimit;

            opened = new Date(p.opened);

                        transactions = new ArrayList(p.transactions);

            }

            /

           

            // CONSTRUCTOR with 3 arguments

            public BankAccount(int no1, String namehere, double bal1)

            {

                        accountNo = no1;

                        accountName = namehere;

                        balance = bal1;

        overdraftLimit = 0;

                        opened = new Date();

                        transactions = new ArrayList();

                        transactions.add(new Trans(Trans.TRANSTYPE[4],bal1,bal1));

            }

           

            // we have created a clone method here

            public Object clone()

    {

        BankAccount z = new BankAccount();

        z.accountNo = accountNo;

        z.acccountName = accountName;

        z.balance = balance;

                        z.overdraftLimit = overdraftLimit;

                        z.opened = new Date(opened);

                        z.transactions = new ArrayList(transactions);

        return z;

    }

           

    // This is done to compare the onject passed with equals method

    public boolean equals(Object other)

    {

        return accountNo == ((BankAccount)other).accountNo;

    }

           

            // toString() method - ALWAYS takes the form public String toString()

            // Returns a string representation of the object

            public String toString()

            {

                        return accountNo+": "+accountName+": "+balance;

            }

   

    // These are the various accessor functions:

    public void setAccountName(String name)

    {

        accountName = name;

    }

    public void setOverdraftLimit(double newLimit)

    {

        overdraftLimit = newLimit;

    }

   

    public double getBalance()

    {

        return balance;

    }

    public String getAccountName()

    {

        return accountName;

    }

    public int getAccountNo()

    {

        return accountNo;

    }

    // STATIC METHODS are declared once and used between all Objects

    // created from this class file.

            public static void setINT_RATE(double newIR)

            {

                        INT_RATE = newIR;

            }

   

    public static double getINT_RATE()

    {

        return INT_RATE;

    }

    // UTILITY METHODS

    // To deposit amount into bank->PRECONDITION amount must be positive

            public void deposit(double amount)

            {

                        balance = balance + amount;

                        transactions.add(new Trans(Trans.TRANSTYPE[0],amount,balance));

            }

   

    //Tow withdraw money from bank-> Withdraw with error checking

            public boolean withdraw(double amount)

            {

                        boolean valid = false;

        if (checkWithdraw(amount))

        {

            balance = balance - amount;

                    valid = true;

                                    transactions.add(new Trans(Trans.TRANSTYPE[1],-amount,balance));

        }

        return valid;

    }

           

            // Adds interest to the account

            public void addInterest()

            {

                        double interest = 0;

                        interest = balance*(INT_RATE/100);

                        deposit(interest);

            }

           

            // This method is used to check whether the user has sufficient funds

            // to be able to withdraw the amount specified

            private boolean checkWithdraw(double amount)

            {

                        boolean valid = true;

        if((balance-amount) < odLimit)

        {

            valid = false;

        }

        return valid;

            }

           

            // method to create a String representation of all the

            // transactions on the account.

            public String createfinalStatement()

            {

                        // create a temporary string to hold the whole statement

                        String state = "";

                       

                        // create a reference (pointer) to a Trans object

                        // called temp

                        Trans temp;

                       

                        // loop through all transaction objects in our specific

                        // BankAccount object.

                        for(int i=0; i < transactions.size(); i++)

                        {

                                    temp = (Trans)transactions.get(i);

                                    state = state+" "+temp.toString();

                        }

                        return state;

            }

           

            // This is the main method for testing

public class BankAccountDriver{

            public static void main (String [] args)

            {

                        // This basically used create a new BankAccount object called s1

                        BankAccount s1 = new BankAccount(10, rohan", 500);

                       

                        // This is used to checkwhether it was created correctly

                        System.out.println(s1);

                        // display a blank lines

                        System.out.println();

           

                        // This is done to perform some transactions on the account

                        s1.deposit(700);

                        s1.withdraw(202);

                        s1withdraw(200);

                        s1.addInterest();

                        s1.withdraw(100);

                       

                        // This is to display a statement to the screen

                        System.out.println(sg.createfinalStatement());

            }          

}

Requirements For an application of your choice, describe the problem you aim to solve, design the necessary classes, and implement your design using Java. Your programs should contain at least two classes, and a driver class in which you demonstrate the functionality of your application. Directions Submit the following documents at the completion of your project using the link found at the bottom of the Unit 8 folder: Documentation of the project, containing the algorithm, produced in pseudocode or flowchart, as well as the UML diagram representing the class structure of the program. All files that are part of the project, including source code with the appropriate internal documentation. A file containing snapshots of the running program, or a short video showing the running program. Grading This assignment is graded and required and worth up to 80 points. It will be graded according to the following rubric: Task Points Import required package(s) Use appropriate class identifiers Declare variables and use them appropriately Use arithmetic and logic appropriately Use correct data types Use appropriate control structures Program source code compiles and executes using command line instructions Program executes according to specifications Project conforms to industry standard program design and style Program logic is well-documented

Explanation / Answer

import java.util.ArrayList; public class BankAccount { private static double INT_RATE = 5.6; // ******* ATTRIBUTES or DATA MEMBERS ******* // Stores Account Number private int accNo; // Stores Account Holder's Name private String accName; // Stores balance of the account private double balance; // Store OverDraft Limit private double odLimit; // Store the date that teh account was opened private Date opened; // Store a list of Transactions private ArrayList transactions; // ******* MEMBER METHODS ******* // DEFAULT CONSTRUCTOR // Set attributes to default values that we specify public BankAccount() { accNo = 0; accName = "Empty"; balance = 0.0; odLimit = 0; opened = new Date(); transactions = new ArrayList(); transactions.add(new Trans(Trans.TRANSTYPE[4],0.0,0.0)); } // COPY CONSTRUCTOR public BankAccount(BankAccount a) { accNo = a.accNo; accName = a.accName; balance = a.balance; odLimit = a.odLimit; opened = new Date(a.opened); transactions = new ArrayList(a.transactions); } // CONSTRUCTORS with arguments (Examples) // many of these are not that useful. // CONSTRUCTOR with 1 argument that sets the account no of an account only. public BankAccount(int no) { accNo = no; accName = "Empty"; balance = 0.0; odLimit = 0; opened = new Date(); transactions = new ArrayList(); transactions.add(new Trans(Trans.TRANSTYPE[4],0.0,0.0)); } // CONSTRUCTOR with 3 arguments public BankAccount(int no, String name, double bal) { accNo = no; accName = name; balance = bal; odLimit = 0; opened = new Date(); transactions = new ArrayList(); transactions.add(new Trans(Trans.TRANSTYPE[4],bal,bal)); } // clone method public Object clone() { BankAccount x = new BankAccount(); x.accNo = accNo; x.accName = accName; x.balance = balance; x.odLimit = odLimit; x.opened = new Date(opened); x.transactions = new ArrayList(transactions); return x; } // equals method public boolean equals(Object other) { return accNo == ((BankAccount)other).accNo; } // toString() method - ALWAYS takes the form public String toString() // Returns a string representation of the object public String toString() { return accNo+": "+accName+": "+balance; } // RELEVANT ACCESSOR Methods public void setAccName(String name) { accName = name; } public void setOdLimit(double newLimit) { odLimit = newLimit; } public double getBalance() { return balance; } public String getAccName() { return accName; } public int getAccNo() { return accNo; } // STATIC METHODS are declared once and used between all Objects // created from this class file. public static void setINT_RATE(double newIR) { INT_RATE = newIR; } public static double getINT_RATE() { return INT_RATE; } // UTILITY METHODS // PRECONDITION amount must be positive public void deposit(double amount) { balance = balance + amount; transactions.add(new Trans(Trans.TRANSTYPE[0],amount,balance)); } // Withdraw with error checking public boolean withdraw(double amount) { boolean valid = false; if (checkWithdraw(amount)) { balance = balance - amount; valid = true; transactions.add(new Trans(Trans.TRANSTYPE[1],-amount,balance)); } return valid; } // Adds interest to the account public void addInterest() { double interest = 0; interest = balance*(INT_RATE/100); deposit(interest); } // method to chek whether the user has sufficient funds // to be able to withdraw the amount specified private boolean checkWithdraw(double amount) { boolean valid = true; if((balance-amount)