title: bank account client in java with multiple classes
body: <p>I am trying to make a bank account program, but I cannot figure out how to get all my variables visible to every class that I have, or how to make the withdrawal and deposit methods of my code visible. Can anyone look at my code and tell me what is wrong? I only want input and output in the client class.</p>
  
  <p>Thanks</p>
  
  <h1>Client Class</h1>
  
  <pre><code>public class Client {
    public static void main(String args[]) {
      Scanner input = new Scanner(System.in);       
      System.out.println("Enter your Name: ");
      String cusName = input.nextLine();
      System.out.println("Enter Account Type: ");
      String type = input.next();
      System.out.println("Enter Initial Balance: ");
      int bal = input.nextInt();
      BankAccount b1 = new BankAccount(cusName, num, type, bal);
      int menu;
      System.out.println("Menu");
      System.out.println("1. Deposit Amount");
      System.out.println("2. Withdraw Amount");
      System.out.println("3. Display Information");
      System.out.println("4. Exit");
      boolean quit = false;
      do {
        System.out.print("Please enter your choice: ");
        menu = input.nextInt();
        switch (menu) {
        case 1:
          b1.deposit();
          break;
  
        case 2:
          b1.withdraw();
          System.out.println("Current Account Balance=" + Balance);
          System.out.print("Enter withdrawal amount:");
          amount = input.nextInt();
          break;
  
        case 3:
          b1.display();
          break;
  
        case 4:
          quit = true;
          break;
        }
      } while (!quit);
    }
  }
  </code></pre>
  
  <h1>Money Class</h1>
  
  <pre><code>public class Money
  {
  
    static int accountNumber, Balance, amount;
    Scanner input = new Scanner(System.in);
    static String name, actype;
    public int deposit() {
      System.out.print("Enter depost amount:");
      amount = input.nextInt();
      if (amount &lt; 0) {
        System.out.println("Invalid");
        return 1;
      }
      Balance = Balance + amount;
      return 0;
    }
  
    int withdraw()  {
  
      if (Balance &lt; amount) {
        System.out.println("Not enough funds.");
        return 1;
      }
      if (amount &lt; 0) {
        System.out.println("Invalid");
        return 1;
      }
      Balance = Balance - amount;
      return 0;
    }
  
  }
  </code></pre>
  
  <h1>BankAccount Class</h1>
  
  <pre><code>class BankAccount {
    Scanner input = new Scanner(System.in);
    static String name, actype;
    static int bal, amt;
    Random randomGenerator = new Random();
    int accNo = randomGenerator.nextInt(100);
  
    BankAccount(String name, int accNo, String actype, int bal) {
      this.name = name;
      this.accNo = accNo;
      this.actype = actype;
      this.bal = bal;
    }
    void display() {
      System.out.println("Name:" + name);
      System.out.println("Account No:" + accNo);
      System.out.println("Balance:" + bal);
  
    }
  
    void dbal() {
      System.out.println("Balance:" + bal);
    }
  }
  </code></pre>