/**
 * This class demonstrates scope and control flow in Java.
 *
 * @author Sara Sprenkle
 *
 */
public class AccountCheck {  
    
   /**
    * Called when user runs 
    *  java AccountCheck
    */
    public static void main(String[] args) {
        int purchaseAmount = 700;
        int availableCredit = 500;
        
        boolean approved = false;

        if (purchaseAmount < availableCredit) {
            availableCredit -= purchaseAmount;
            /* scope of following declarated variable 
             is within this block of code
             and cannot be seen outside of this block. 
             boolean approved = false;
             */
            approved = true;
        }

        if( ! approved ) 
            System.out.println("Denied");
    }
}

