title: WithDraw money From an Account (Java)
body: <p>I'm doing the exercise (3.11) from Deital How to Program 10th Edition there is no error in my program but i want that when the withdraw money is greater then balance then it should show only "Insufficient Balance" message, it should not show the balance amount kindly help me i'm just a beginner.</p>
  
  <p>that is my main program</p>
  
  <pre><code>package practice;
  import java.util.Scanner;
  public class apple {
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          tuna account1 = new tuna ("James" , 150000);
          tuna account2 = new tuna ("David" , 5000);
          System.out.printf("%s Balance: %.2f" , account1.getName(),account1.getBalance());
          System.out.printf("%n%s Balance: %.2f" , account2.getName(), account2.getBalance());
          System.out.print("\nEnter the Ammount that will add in James Account: ");
          double depositAmmount = input.nextDouble();
          System.out.printf("Adding %.2f to James Account", depositAmmount);
          account1.deposit(depositAmmount);
          System.out.printf("%n%s Balance: %.2f" , account1.getName(),account1.getBalance());
          System.out.print("\nEnter the Ammount that will add in David Account: ");
          depositAmmount = input.nextDouble();
          System.out.printf("Adding %.2f to David Account", depositAmmount);
          account2.deposit(depositAmmount);
          System.out.printf("%n%s Balance: %.2f" , account2.getName(),account2.getBalance());
          System.out.print("\nEnter the Ammount that will withdrawal from james Account: ");
          double wD = input.nextDouble();
          System.out.printf("WithDrawal %.2f from James Account",wD);
          account1.withDrawal(wD);
          System.out.printf("%n%s Balance: %.2f" , account1.getName(),account1.getBalance());
      }
          }
  </code></pre>
  
  <p>and that is the class </p>
  
  <pre><code>package practice;
  
  public class tuna {
  private String name;
  private double balance;
  public tuna (String name , double balance){
      this.name = name;
      if (balance &gt; 0)
          this.balance = balance;
  }
  public void deposit(double depositAmmount){
      if (depositAmmount &gt; 0)
          balance = balance + depositAmmount;
  }
  public void withDrawal (double wD){
      if (wD &gt; balance)
          System.out.println("\nInsufficient Balance");
      else 
      balance = balance - wD;
  }
  public double getBalance(){
      return balance;
  }
  public void setName(String name){
      this.name = name;
  }
  public String getName(){
      return name;
  }
  }
  </code></pre>