コード例 #1
0
ファイル: CLI.cs プロジェクト: DSDanStone/VendingMachine
        /// <summary>
        /// Finishes the transaction and dispenses change
        /// </summary>
        private void FinishTransaction()
        {
            // Get variables from methods
            Change             change = this.VendingMachine.MakeChange();
            List <VendingItem> items  = this.VendingMachine.ClearTheTray();

            // Print the user's change and fun messages
            Console.Clear();
            Console.WriteLine(change.ToString());
            PrintFunMessages(items);
            Console.WriteLine("Have a nice day!");
        }
コード例 #2
0
        public string ReturnChange() // Return change sets the vending machine's balance field to 0, and returns a string
                                     // containing the coins they should receive back
        {
            VendingWriter vr = new VendingWriter();
            string        recordTransaction = ("GIVE CHANGE: $" + balance.ToString());

            Change coins = new Change(balance);

            balance = 0.00M;

            recordTransaction += " $0.00";
            vr.WritingAFile(recordTransaction);

            return(coins.ToString());
        }