public class SodaMachine
{
    private int Cokes;
    private int Sprites;
    private int DrPeppers;
    private int DietCokes;
    private int deposit;
    private int priceOfSoda;

    //SodaMachine();
    // Example:
    //		SodaMachine M;
    //
    //		M is a sodamachine  object initialed as follows:
    //			number of Cokes =
    //			number of Sprites =
    //			number of Dr. Peppers =
    //			number of Diet Cokes = 25 //default value is 25
    //			amount deposited = 0
    //			price for a can of soda = 75 cents   
    SodaMachine()
    {
        Cokes = Sprites = DrPeppers = DietCokes = 25;
        deposit = 0;
        priceOfSoda = 75;
    }

    //SodaMachine(double valueNumberCans, double valuePriceOfSoda);
    // Example:
    //		SodaMachine  N(20,60);
    //
    //		N is a sodamachine  object initialed as follows:
    //			number of Cokes =
    //			number of Sprites =
    //			number of Dr. Peppers =
    //			number of Diet Cokes = 20
    //			amount deposited = 0
    //			price for a can of soda = 60 cents   
    SodaMachine(int valueNumberCans, int valuePriceOfSoda)
    {
        Cokes = Sprites = DrPeppers = DietCokes = valueNumberCans;
        deposit = 0;
        priceOfSoda = valuePriceOfSoda;
    }

    // precondition : none
    // postcondition : value is added to amount currently in machine
    // Example :X.insertcoins(75);    
    public void insertCoins(int value)
    {
        deposit = deposit + value;
    }

    //precondition: none
    //postcondition deposit in machine is 0
    //Example: X.returnCoins();   
    public void returnCoins()
    {
        deposit = 0;
    }

    // precondition:  none
    // postcondition: deposit currently in machine is displayed
    // Example: X.showamount();  
    public int showAmount()
    {
        System.out.println("Amount of coins is: " + deposit);
            return deposit;
    }

    // precondition:  amount deposited must be equal to price of can of soda
    //                there must be a soda available
    // postcondition: numCoke is decremented; amount set back to 0
    // Example: X.buyCoke();
    public void buyCoke()
    {
        if ((Cokes > 0) && (deposit >= priceOfSoda))
        {
            Cokes--;
            deposit = deposit - priceOfSoda;
        }

    }

    // precondition:  amount deposited must be equal to price of can of soda
    //                there must be a soda available
    // postcondition: numSprite is decremented; amount set back to 0
    // Example: X.buySprite();
    public void buySprite()
    {
        if ((Sprites > 0) && (deposit >= priceOfSoda))
        {
            Sprites--;
            deposit = deposit - priceOfSoda;
        }

    }

    // precondition:  amount deposited must be equal to price of can of soda
    //                there must be a soda available
    // postcondition: numDrPepper is decremented; amount set to 0
    // Example: X.buyDrPepper();
    public void buyDrPepper()
    {
        if ((DrPeppers > 0) && (deposit >= priceOfSoda))
        {
            DrPeppers--;
            deposit = deposit - priceOfSoda;
        }

    }

    // precondition: amount deposited must be equal to price of can of soda
    //               there must be a soda available
    // postcondition: numDietCoke is decremented amount set back to 0
    // Example: X.buyDietCoke();
    public void buyDietCoke()
    {
        if ((DietCokes > 0) && (deposit >= priceOfSoda))
        {
            DietCokes--;
            deposit = deposit - priceOfSoda;
        }
    }
}
