using System.Text.RegularExpressions;
namespace Cohen_Brett_HW1
public const decimal TacoPrice = 2.00m;
public const decimal SandwichPrice = 7.00m;
public const decimal TaxRate = .0825m;
public static void Main(string[] args)
String strCustCodeInput = "";
int intTacoCountInput = 0;
String strTacoCountInput = "";
int intSandwichCountInput = 0;
String strSandwichCountInput = "";
Boolean boolCodeValid = false;
Console.WriteLine("Please enter the customer code:");
strCustCodeInput = Console.ReadLine();
boolCodeValid = CheckCode(strCustCodeInput);
} while (boolCodeValid == false);
Console.WriteLine("Enter the number of tacos you would like to order:");
strTacoCountInput = Console.ReadLine();
intTacoCountInput = CheckItem(strTacoCountInput);
} while (intTacoCountInput == -1);
Console.WriteLine("Enter the number of sandwiches you would like to order:");
strSandwichCountInput = Console.ReadLine();
intSandwichCountInput = CheckItem(strSandwichCountInput);
} while (intSandwichCountInput == -1);
if (intTacoCountInput + intSandwichCountInput == 0)
Console.WriteLine("Total number of items ordered must be greater than 0." + "\n");
} while (intTacoCountInput + intSandwichCountInput < 1);
int intTotalItemCount = intTacoCountInput + intSandwichCountInput;
decimal TacoSubtotal = TacoPrice * intTacoCountInput;
decimal SandwichSubtotal = SandwichPrice * intSandwichCountInput;
decimal CombinedSubtotal = TacoSubtotal + SandwichSubtotal;
decimal TaxAmount = CombinedSubtotal * TaxRate;
decimal GrandTotal = CombinedSubtotal + TaxAmount;
Console.WriteLine("Customer Code: " + strCustCodeInput.ToUpper());
Console.WriteLine("Total Items: " + intTotalItemCount);
Console.WriteLine("Taco Subtotal: " + (TacoSubtotal.ToString("C")));
Console.WriteLine("Sandwich Subtotal: " + (SandwichSubtotal.ToString("C")));
Console.WriteLine("Full Subtotal: " + (CombinedSubtotal.ToString("C")));
Console.WriteLine("Sales Tax: " + (TaxAmount.ToString("C")));
Console.WriteLine("Grand Total: " + (GrandTotal.ToString("C")));
Console.WriteLine("Press any key to exit");
public static Boolean CheckCode(String strInput)
if (strInput.Length < 4 || strInput.Length > 6)
Console.Write("Please enter a valid code, 4 to 6 characters, letters only." + "\n");
return Regex.IsMatch(strInput, @"^[a-zA-Z]+$");
static int CheckItem(String strInput)
NowInt = Convert.ToInt32(strInput);
Console.Write("Please enter a valid number greater than or equal to 0." + "\n");