コード例 #1
0
 public static void Main()
 {
     try
     {
         int cents = GetChangeOwedInput();
         CoinSorter.SortCoins(cents);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Main();
     }
 }
コード例 #2
0
        public static int GetChangeOwedInput()
        {
            Console.WriteLine("Customer owes: [example formats: '$0.71' or '$12.01' or '$2']");
            Console.Write("$");
            int total = CoinSorter.ParseCents(Console.ReadLine());

            Console.WriteLine("Customer paid:");
            Console.Write("$");
            int paid = CoinSorter.ParseCents(Console.ReadLine());

            Console.WriteLine($"Change due: {CoinSorter.ConvertToDollarString(paid - total)}");
            return(paid - total);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            CoinSorter cs = new CoinSorter();

            Console.ReadKey();
        }
コード例 #4
0
        public void Sort_SortValuesUnder5_Pennies()
        {
            CoinSorter change = new CoinSorter();

            Assert.AreEqual(4, change);
        }
コード例 #5
0
 public CoinSortMachine()
 {
     this.coinSortFirstLink = new PennySorter(coinPockets);
     coinSortFirstLink.SetNextSorter(new NickelSorter(coinPockets));
 }