Exemple #1
0
 public static void CreditCard()
 {
     while (true)
     {
         try
         {
             string cardNum = MiscMethods.GetInfo("Enter Card Number");
             string cardExp = MiscMethods.GetInfo("Enter Card Exp (mm/yy)");
             if (MiscMethods.IsOnlyDigits(cardNum) == false)
             {
                 Console.WriteLine("Card Number is not all digits. Try again"); continue;
             }
             if (cardNum.Length != 16)
             {
                 Console.WriteLine("Card number is not the right number of digits. Try again"); continue;
             }
             int month = int.Parse(cardExp.Substring(0, 2));
             int year  = int.Parse(cardExp.Substring(3, 2));
             if (month > 12 || month <= 0 || year < int.Parse(DateTime.Now.ToString("yy")))
             {
                 Console.WriteLine("Incorrect date. Please try agian"); continue;
             }
             Console.WriteLine("Payment Accepted");
             break;
         }
         catch { Console.WriteLine("Incorrect entry. Try again"); continue; }
     }
 }
Exemple #2
0
        public static double TaxNum(double subtotal)
        {
            string tax = (subtotal * .06).ToString("0.00");

            Console.WriteLine(MiscMethods.RecieptLine("Tax:", tax));
            return(subtotal * .06);
        }
        public static double FinalTotal(double subtotal, double tax)
        {
            double finalTotal = (subtotal + tax);

            Console.WriteLine(MiscMethods.RecieptLine("Grand Total", finalTotal.ToString("0.00")));
            return(finalTotal);
        }
 public static void PrintReciept(double subtotal, double tax, string paymentMethod, List <Item> PurchaseList)
 {
     Console.WriteLine("****************Thank you for shopping at Derby Central****************");
     foreach (Item x in PurchaseList)
     {
         Console.WriteLine(MiscMethods.RecieptLine(x.Name, x.Price.ToString()));
     }
     Console.WriteLine("\n\n" + MiscMethods.RecieptLine("SUBTOTAL", subtotal.ToString()));
     Console.WriteLine("\n" + MiscMethods.RecieptLine("TAX", tax.ToString()));
     Console.WriteLine("\n" + MiscMethods.RecieptLine("GRAND TOTAL", (tax + subtotal).ToString()));
     Console.WriteLine("\n" + MiscMethods.RecieptLine("PAYMEND METHOD", paymentMethod));
     Console.WriteLine("****************Thank you for shopping at Derby Central****************");
 }
Exemple #5
0
 public static void CheckPay()
 {
     while (true)
     {
         string ActNum  = MiscMethods.GetInfo("Enter annount number");
         string RoutNum = MiscMethods.GetInfo("Enter routing number");
         if (MiscMethods.IsOnlyDigits(ActNum) == false || MiscMethods.IsOnlyDigits(RoutNum) == false)
         {
             Console.WriteLine("Incorrect entry. Try again"); continue;
         }
         if (RoutNum.Length != 9 || ActNum.Length >= 17)
         {
             Console.WriteLine("Incorrect entry. Try again"); continue;
         }
         Console.WriteLine("Payment Accepted");
         break;
     }
 }
Exemple #6
0
 public static void PayInCash(double total)
 {
     while (true)
     {
         try
         {
             double tendered = double.Parse(MiscMethods.GetInfo("Enter amount tendered"));
             if (tendered >= total)
             {
                 Console.WriteLine($"Change: {(tendered - total).ToString("0.00")}\n");
                 break;
             }
             else
             {
                 total = total - tendered;
                 Console.WriteLine($"{total} is still owed.");
                 continue;
             }
         }
         catch { Console.WriteLine("Incorrect Entry. Try again."); continue; }
     }
 }