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

Bank Account Create a menu driven simple bank account application. It will suppo

ID: 3557049 • Letter: B

Question

Bank Account

Create a menu driven simple bank account application.
It will support the following operations:
- deposit money
- withdraw
- check balance
- Create new account

Example of the console:
1. Deposit money
2. Withdraw money
3. Check balance
4. Create new account
Your choice, 0 to quit:

Create BankAccount Object that holds account number, first name, last name, and initial balance

Since we don't have a database to use, to simply this project you will add just 4 accounts and process different transactions(deposit, withdraw, check balance) with them before ending the program (option 0 to quit)

If you select option 1 or 2 you need to ask for account number and amount. Then after processing display on the console the Account Number and current balance.

If option 3 is selected you need to ask for the account number and after processing display on the console the Account Number and current balance.

If option 4 is selected you need to ask for first name, last name, and initial balance. Then after processing display on the console a message thanking the account holder for joining the bank.
  
Make sure you add validations and display proper messages.
- invalid option is selected
- user can't withdraw money they don't have
- user's first and last name must be at least 3 characters each

When the program quits:
1. Display to the console the Account that has the highest balance and the one that has the lowest balance.
2. Write contents of the BankAccount to a file called MyBank.txt (comma delimited file)


Example of the console:
Highest balance: Account 2 Amount $1532.57
Lowest balance: Account 4 Amount $35.15

Example of MyBank file:
1,John,Smith,2345.99
2,Jane,Doe,1496.23
3,Jack,Clone,3645.87
4,Sara,James,21568.32


When this is complete send me all your java files, and the MyBank.txt file as well as a screen shot of the console showing the application in use.

Explanation / Answer

import java.util.Scanner;

public class BankAccount {

      public static void main(String[] args) {

            Scanner in = new Scanner(System.in);

            int userChoice;

            boolean quit = false;

            float balance = 0f;

            do {

                  System.out.println("1. Deposit money");

                  System.out.println("2. Withdraw money");

                  System.out.println("3. Check balance");

                  System.out.print("Your choice, 0 to quit: ");

                  userChoice = in.nextInt();

                  switch (userChoice) {

                  case 1:

                        float amount;

                        System.out.print("Amount to deposit: ");

                        amount = in.nextFloat();

                        if (amount <= 0)

                             System.out.println("Can't deposit nonpositive amount.");

                        else {

                             balance += amount;

                             System.out.println("$" + amount + " has been deposited.");

                        }

                        break;

                  case 2:

                        System.out.print("Amount to withdraw: ");

                        amount = in.nextFloat();

                        if (amount <= 0 || amount > balance)

                             System.out.println("Withdrawal can't be completed.");

                        else {

                             balance -= amount;

                             System.out.println("$" + amount + " has been withdrawn.");

                        }

                        break;

                  case 3:

                        System.out.println("Your balance: $" + balance);

                        break;

                  case 0:

                        quit = true;

                        break;

                  default:

                        System.out.println("Wrong choice.");

                        break;

                  }

                  System.out.println();

            } while (!quit);

            System.out.println("Bye!");

      }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote