All pastes #173540 Raw Edit

Something

public text v1 · immutable
·published 2006-09-17 01:41 UTC
rendered paste body

/**
 * VendingMachne simulates a campus vending machine.
 * 
 * @author Chuck Bates 
 * @version 8/16
 */
public class VendingMachine
    {
    private int drinks = 10;
    private int price = 125;
    private int balance = 0;
    /**
     * Constructor for objects of class VendingMachine
     */
    public VendingMachine()
    {
      
    }

    /**
     * displayGreeting displays a brief welcome and warns customer 
     * if the vending machine is empty
     */
    public void displayGreeting()
    {
        System.out.println(" Thank you for using this machine ");
        
        if(drinks < 1){
            System.out.println(" I am sorry, the machine is currently empty ");
            
           }else{ 
               return;
            }
    }
    
    /**
     * getPrice returns the proce of one drink
     */

    public int getPrice()
    {       
        return price;
    }   
       
       /**
        * insertMoney adds the number of cents to the credit balance. 
        */
       
       public int insertMoney(int amount)
     {
           
           if( drinks < 0 ){
               
               displayGreeting();
                }else{
              // balance = balance + amount;
           return balance;
		} 
     }
       





} // end of class