Create a Java program that models a bank account. The program should have the following features:
Question:
Create a Java program that models a bank account. The program should have the following features:
• A BankAccount class that has attributes for the account holder's name, account number, and balance.
• The BankAccount class should have a constructor that accepts parameters for the account holder's name and account number, but sets the balance to 0 by default.
• The BankAccount class should have methods for depositing money into the account, withdrawing money from the account, and checking the current balance.
• The program should provide a menu-based interface that allows users to interact with the bank account system. The menu should have options for depositing money into the account, withdrawing money from the account, and checking the current balance. The program will end only when the user selects option number 4. Menu interface:
• The program should be tested to ensure it is functioning correctly and handles all possible edge cases. In case the user tries to withdraw money and does not have enough funds, print the " Insufficient funds." message.
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp