コード例 #1
0
        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);
        }
コード例 #2
0
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

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



            return(outPut);
        }
コード例 #3
0
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

            outPut += "No gumball dispensed\n";



            return(outPut);
        }
コード例 #4
0
        public string Dispense()

        {
            string outPut;



            outPut = gumballMachine.ReleaseBall();

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



            return(outPut);
        }
コード例 #5
0
        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);
        }