In this program, you will develop three classes called Bank, Account, and Custom
ID: 3639968 • Letter: I
Question
In this program, you will develop three classes called Bank, Account, and Customer to store account information and customer information of a bank.
Bank class can have maximum five accounts and five customers.
Account object can have only one account holder.
Customer class can have maximum two accounts. For the SSN number, you can useany integer value in the project.
DemoProgram:
import java.util.Scanner;
public class BankDemo
{
public static void main(String[] args)
{
Scanner sc = new Scanner (System.in);
Bank csumbBank = new Bank(“CSUMB”);
int option;
System.out.println("Welcome to CSUMB Bank");
do
{
System.out.println("Select your choice:");
System.out.println(" 1. Open an account");
System.out.println(" 2. Close an account");
System.out.println(" 3. Account Info");
System.out.println(" 4. Customer Info");
System.out.println(" 5. Bank Info");
System.out.println(" 6. Exit");
option = sc.nextInt();
if (option == 1)
{
csumbBank.openAccount();
}
else if (option == 2)
{
csumbBank.closeAccount();
}
else if (option == 3)
{
csumbBank.accountInfo();
}
else if (option == 4)
{
csumbBank.customerInfo();
}
else if (option == 5)
{
csumbBank.bankInfo();
}
else if (option == 6)
{
System.out.println("Bye");
return;
}
else
{
System.out.println("Incorrect option");
}
System.out.println(" ");
} while (true);
}
}
Explanation / Answer
import java.util.Scanner; public class BankDemo { public static void main(String[] args) { Scanner sc = new Scanner (System.in); Bank csumbBank = new Bank(“CSUMB”); int option; System.out.println("Welcome to CSUMB Bank"); do { System.out.println("Select your choice:"); System.out.println(" 1. Open an account"); System.out.println(" 2. Close an account"); System.out.println(" 3. Account Info"); System.out.println(" 4. Customer Info"); System.out.println(" 5. Bank Info"); System.out.println(" 6. Exit"); option = sc.nextInt(); if (option == 1) { csumbBank.openAccount(); } else if (option == 2) { csumbBank.closeAccount(); } else if (option == 3) { csumbBank.accountInfo(); } else if (option == 4) { csumbBank.customerInfo(); } else if (option == 5) { csumbBank.bankInfo(); } else if (option == 6) { System.out.println("Bye"); return; } else { System.out.println("Incorrect option"); } System.out.println(" "); } while (true); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.