Bank.java - import java.util.Scanner public class Bank cfw declare private instance variables declare a Scanner object Constructor public Bank(String

Bank.java - import java.util.Scanner public class Bank cfw...

This preview shows page 1 - 2 out of 3 pages.

import java.util.Scanner; public class Bank { // declare private instance variables // declare a Scanner object // Constructor public Bank(String bankName) { // assign parameter value to instance variable // prompt user for number of accounts // initialize array of accounts with size // from user input // use a classic for loop to iterator through // accounts array for (int i = 0; i < accounts.length; i++) { // declare local variables to use // to collect info about account String lastName, firstName, emailAddress; long accNumber, phoneNumber; // print header for account info String header = "Enter details of account holder " + (i+1)); System.out.println(header); for (int j = 0; j < header.length; j++) System.out.print("="); System.out.println(); // prompt user and input long account number // prompt user and input first and last names // declare and instantiate a new Customer Customer c = new Customer(firstName, lastName); // declare and instantiate a new Account accounts[i] = new Account(accNumber, c); // prompt for phone number and call setter method

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture