title: Java double.MAX_VALUE?
body: <p>For my assignment I have to create a Gas Meter System for a Gas company to allow employees to create new customer accounts and amend data such as name and unit costs along with taking (depositing) money from their account.</p>
  <p>I have created my constructor and even added in a method of overloading although I'm currently running into a problem when initiating one of my methods I named <code>deposit()</code>, this is supposed to take money from the users account while other methods such as <code>recordUnits()</code> allows the employee to import a gas meter reading of how many units the customer has used and updates the balance of that customers account which is essentially what the customer owes the company.</p>
  <p>When testing the program with just preset information when trying to initiate the deposit method I get this</p>
  <pre><code>Account.deposit(Double.MAX_VALUE);
  </code></pre>
  <p>I am not too sure what this means and cannot seem to find anyway of getting past it!</p>
  <p>test data and code seen below:</p>
  <pre><code>public class TestGasAccount 
  
  {
      public static void main (String [] args)
      {
          GasAccount Account = new GasAccount (223,&quot;Havana&quot;,&quot;TQ&quot;,1000);
          
          Account.getAccNo();
          Account.getName();
          Account.getAddress();
          Account.getUnits();
          Account.getBalance();
          Account.recordUnits(1000);
          Account.getUnits();
          Account.getBalance();
          Account.deposit(Double.MAX_VALUE);
      }
  }
  
  public class GasAccount 
  {
      private int intAccNo;
      private String strName;
      private String strAddress; 
      private double dblBalance;
      private double dblUnits;
      protected double dblUnitCost = 0.02; 
      
       public GasAccount(int intNewAccNo,String strNewName,String strNewAddress,double dblNewUnits)
       {
           intAccNo = intNewAccNo;
           strName = strNewName;
           strAddress = strNewAddress;
           dblUnits = dblNewUnits;
           dblBalance = dblNewUnits * dblUnitCost;
       }
       
       public GasAccount (int intNewAccNo, String strNewName, String strNewAddress)
       {
           intAccNo = intNewAccNo;
           strName = strNewName;
           strAddress = strNewAddress;
       }
       
       public double deposit (Double dblDepositAmount)
       {
          dblBalance = dblBalance - dblDepositAmount; 
          return dblBalance;
       }
       
       public String recordUnits (double dblUnitsUsed)
       {
           double dblTempBalance;
           
           dblTempBalance = dblUnitsUsed * dblUnitCost;
           dblBalance = dblBalance + dblTempBalance;
           dblUnits = dblUnits + dblUnitsUsed;
           
           return &quot;Transaction Successful&quot;; 
       }
       
       public int getAccNo ()
       {
           System.out.println(intAccNo);
           return intAccNo;
       }
       
       public String getName()
       {
           System.out.println(strName);
           return strName; 
       }
       
        public String getAddress()
       {
           System.out.println(strAddress);
           return strName; 
       }
       
       public double getBalance()
       {
           System.out.println(&quot;£&quot;+dblBalance);
           return dblBalance; 
       }
       
       public double getUnitCost()
       {
          
           return dblUnitCost;
       }
       
       public double getUnits ()
       {
           System.out.println(dblUnits);
           return dblUnits;
       }
       
       public void updateUnitCost (double dblNewUnitCost)
       {
           dblUnitCost = dblNewUnitCost;
       }
  }
  </code></pre>