public string Dispense()

        {
            string outPut;

            outPut = "YOUR A WINNER! You get two gumballs for your quarter\n";

            outPut += gumballMachine.ReleaseBall();

            if (gumballMachine.Count == 0)

            {
                gumballMachine.StateOfMachine = soldOutState;
            }

            else

            {
                outPut += gumballMachine.ReleaseBall();

                if (gumballMachine.Count > 0)

                {
                    gumballMachine.StateOfMachine = noQuarterState;
                }

                else

                {
                    outPut += "Oops, out of gumballs!\n";

                    gumballMachine.StateOfMachine = soldOutState;
                }
            }

            return(outPut);
        }
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

            outPut += "You need to pay first\n";



            return(outPut);
        }
Exemple #3
0
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

            outPut += "No gumball dispensed\n";



            return(outPut);
        }
Exemple #4
0
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

            outPut += "You turned, but there are no gumballs\n";



            return(outPut);
        }
        public string Dispense()
        {
            string outPut;

            outPut = gumballMachine.ReleaseBall();
            if (gumballMachine.Count > 0)
            {
                gumballMachine.StateOfMachine = noQuarterState;
            }
            else
            {
                gumballMachine.StateOfMachine = soldOutState;
                outPut += "Oops, out of gumballs!\n";
            }

            return(outPut);
        }