/**
 * This class demonstrates control flow in Java
 *
 * @author Sara Sprenkle
 *
 */
public class AccountCheck {  
    
    /* Alternatively, could make the variable have a "class-level" scope
    instead of just being within the method. 
    Probably not appropriate for this problem, but may be appropriate
    in other cases.
    
    static boolean approved = false;
    */
    
   /**
    * Called when user runs 
    *  java AccountCheck
    */
    public static void main(String[] args) {
        int purchaseAmount = 700;
        int availableCredit = 500;
        
        if (purchaseAmount < availableCredit) {
            availableCredit -= purchaseAmount;
            /* scope of variable is within this block of code
             and cannot be seen outside of this block. */
            boolean approved = true;
            approved = true;
        }

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

