Thank you for any assitance that you can provide. Need help with the following: Include comments at the beginning of each class that explain the purpose and functionality. Added additional error checking/validation mechanisms to ensure balance cannot be set to negative. Program now handles overdraft fees separately from withdrawals. Modified the logic to deduct the fee first and then proceed with the withdrawal. Override the toString method from the AccountBank class to provide a more standardized and convenient way of displaying the account information. Included some test cases in the Main class to demonstrate the functionality of the implemented classes. Java source code: Bank Account Class  package bankAccount; public class AccountBank {     //Variables     private String firstName;     private String lastName;     private int accountID;     private double balance;          public AccountBank() {         this.balance = 0;     }     public AccountBank(String firstName, String lastName, int accountID, double balance) {         this.firstName = firstName;         this.lastName = lastName;         this.accountID = accountID;         this.balance = balance;     }     //Setter & getter section for firstName, lastName, and accountID methods.     public String getFirstName() {         return firstName;     }     public String getLastName() {         return lastName;     }     public int getAccountID() {         return accountID;     }     public double getBalance() {         return balance;     }     public void setFirstName(String firstName) {         this.firstName = firstName;     }     public void setLastName(String lastName) {         this.lastName = lastName;     }     public void setAccountID(int accountID) {         this.accountID = accountID;     }            public void deposit(double transaction) {         this.balance += transaction;     }          public void withdrawal(double transaction) {         this.balance -= transaction;     }     public String accountSummary() {         System.out.println("\nAccount Summary:");         String name = "First Name: " + firstName + "\nLast Name: " + lastName + "\n";         String accountInfo = name + "Account Number: " + accountID + "\nBalance: $" + balance;         return accountInfo;     } } }     public int getAccountID() {         return accountID;     }     public double getBalance() {         return balance;     }     public void setFirstName(String firstName) {         this.firstName = firstName;     }     public void setLastName(String lastName) {         this.lastName = lastName;     }     public void setAccountID(int accountID) {         this.accountID = accountID;     }          public void deposit(double transaction) {         this.balance += transaction;     }          public void withdrawal(double transaction) {         this.balance -= transaction;     }     public String accountSummary() {         System.out.println("\nAccount Summary:");         String name = "First Name: " + firstName + "\nLast Name: " + lastName + "\n";         String accountInfo = name + "Account Number: " + accountID + "\nBalance: $" + balance;         return accountInfo;     } } Checking Account Class package bankAccount; public class CheckingAccount extends AccountBank {          private double interestRate;          public CheckingAccount(String firstName, String lastName, int accountID, double balance ) {         super(firstName, lastName, accountID, balance); //Referring to superclass          this.interestRate = 0.02; //interestRate attribute     }     public void processWithdrawal(double transaction) {         if (transaction > this.getBalance()) {             System.out.println("Non-sufficient funds (NSF)! An overdraft fee of $30 has been charged to your account.");             this.withdrawal(30);             this.withdrawal(transaction);         } else {             this.withdrawal(transaction);         }     }          public void displayAccount() {         System.out.println("\nPersonal Checking Account Information:");         System.out.println("First Name: " + this.getFirstName());         System.out.println("Last Name: " + this.getLastName());         System.out.println("Account ID: " + this.getAccountID());         System.out.println("Balance: $" + this.getBalance());         System.out.println("Interest Rate: " + interestRate + "%");     } } Test Class package bankAccount; //Test class public class Main {     public static void main(String[] args) {         //New instance for CheckingAccount.         CheckingAccount obj = new CheckingAccount("Art", "Vandelay", 25088601, 250.0);         System.out.println(obj.accountSummary());         System.out.println("\nMaking a deposit of $50..");         obj.deposit(50);//New instance for deposit.         System.out.println("New Balance: $" + obj.getBalance());//Display new balance.         System.out.println("\nMaking a withdrawal of $320..");         obj.processWithdrawal(320);//New instance for withdrawal.         System.out.println("New Balance: $" + obj.getBalance());         obj.displayAccount();      } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Thank you for any assitance that you can provide. Need help with the following:

  • Include comments at the beginning of each class that explain the purpose and functionality.
  • Added additional error checking/validation mechanisms to ensure balance cannot be set to negative.
  • Program now handles overdraft fees separately from withdrawals.
  • Modified the logic to deduct the fee first and then proceed with the withdrawal.
  • Override the toString method from the AccountBank class to provide a more standardized and convenient way of displaying the account information.
  • Included some test cases in the Main class to demonstrate the functionality of the implemented classes.

Java source code:

Bank Account Class 
package bankAccount;

public class AccountBank {
    //Variables
    private String firstName;
    private String lastName;
    private int accountID;
    private double balance;
    
    public AccountBank() {
        this.balance = 0;
    }
    public AccountBank(String firstName, String lastName, int accountID, double balance) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.accountID = accountID;
        this.balance = balance;
    }

    //Setter & getter section for firstName, lastName, and accountID methods.
    public String getFirstName() {
        return firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public int getAccountID() {
        return accountID;
    }
    public double getBalance() {
        return balance;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public void setAccountID(int accountID) {
        this.accountID = accountID;
    }
    
 
    public void deposit(double transaction) {
        this.balance += transaction;
    }
    
    public void withdrawal(double transaction) {
        this.balance -= transaction;
    }
    public String accountSummary() {
        System.out.println("\nAccount Summary:");
        String name = "First Name: " + firstName + "\nLast Name: " + lastName + "\n";
        String accountInfo = name + "Account Number: " + accountID + "\nBalance: $" + balance;
        return accountInfo;
    }
}


}
    public int getAccountID() {
        return accountID;
    }
    public double getBalance() {
        return balance;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public void setAccountID(int accountID) {
        this.accountID = accountID;
    }
    
    public void deposit(double transaction) {
        this.balance += transaction;
    }
    
    public void withdrawal(double transaction) {
        this.balance -= transaction;
    }
    public String accountSummary() {
        System.out.println("\nAccount Summary:");
        String name = "First Name: " + firstName + "\nLast Name: " + lastName + "\n";
        String accountInfo = name + "Account Number: " + accountID + "\nBalance: $" + balance;
        return accountInfo;
    }
}

Checking Account Class

package bankAccount;

public class CheckingAccount extends AccountBank {
    
    private double interestRate;
    
    public CheckingAccount(String firstName, String lastName, int accountID, double balance ) {
        super(firstName, lastName, accountID, balance); //Referring to superclass 
        this.interestRate = 0.02; //interestRate attribute
    }

    public void processWithdrawal(double transaction) {
        if (transaction > this.getBalance()) {
            System.out.println("Non-sufficient funds (NSF)! An overdraft fee of $30 has been charged to your account.");
            this.withdrawal(30);
            this.withdrawal(transaction);
        }
else {
            this.withdrawal(transaction);
        }
    }
    
    public void displayAccount() {
        System.out.println("\nPersonal Checking Account Information:");
        System.out.println("First Name: " + this.getFirstName());
        System.out.println("Last Name: " + this.getLastName());
        System.out.println("Account ID: " + this.getAccountID());
        System.out.println("Balance: $" + this.getBalance());
        System.out.println("Interest Rate: " + interestRate + "%");
    }
}

Test Class
package bankAccount;
//Test class
public class Main {
    public static void main(String[] args) {
        //New instance for CheckingAccount.
        CheckingAccount obj = new CheckingAccount("Art", "Vandelay", 25088601, 250.0);
        System.out.println(obj.accountSummary());

        System.out.println("\nMaking a deposit of $50..");
        obj.deposit(50);//New instance for deposit.
        System.out.println("New Balance: $" + obj.getBalance());//Display new balance.

        System.out.println("\nMaking a withdrawal of $320..");
        obj.processWithdrawal(320);//New instance for withdrawal.
        System.out.println("New Balance: $" + obj.getBalance());

        obj.displayAccount();
     }
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

In the Bank Account class, is there a way to add error-checking/validation mechanisms to ensure the initial balance cannot be set to a negative?

Solution
Bartleby Expert
SEE SOLUTION
Follow-up Question

The processWithdrawal method in the Checking Account class is not processing separately from the withdrawal method in the Bank Account class nor is the withdrawal fee showing up on the console. What is the fix?

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education