Advertisement
tristanx

Simulated Receipt

Aug 26th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Section3a
  8. {
  9.     class Program
  10.     {
  11.         private static string custName;
  12.         private static string custStreet;
  13.         private static string custCity;
  14.         private static string custState;
  15.         private static string custZip;
  16.         private static double custNoBlenders;
  17.         const double SALES_TAX = .07;
  18.         const double BLENDER_PRICE = 39.95;
  19.         private static double custTotal;
  20.         private static double custTax;
  21.         private static double custSubTotal;
  22.  
  23.  
  24.         static void Main(string[] args)
  25.         {
  26.             //interactive user prompt data
  27.  
  28.  
  29.             Console.Write("Please enter your name: ");
  30.             custName = Console.ReadLine();
  31.  
  32.             Console.Write("\nPlease Enter your street address: ");
  33.             custStreet = Console.ReadLine();
  34.  
  35.             Console.Write("\nPlease enter your City: ");
  36.             custCity = Console.ReadLine();
  37.  
  38.             Console.Write("\nPlease enter your State: ");
  39.             custState = Console.ReadLine();
  40.  
  41.             Console.Write("\nPlease enter your Zip Code: ");
  42.             custZip = Console.ReadLine();
  43.  
  44.             Console.Write("\nPlease enter the number of blenders you would like to purchase: ");
  45.             custNoBlenders = Convert.ToDouble(Console.ReadLine());
  46.  
  47.             //Calculations
  48.             custSubTotal = custNoBlenders * BLENDER_PRICE;
  49.             custTax = custSubTotal * SALES_TAX;
  50.             custTotal = custSubTotal + custTax;
  51.  
  52.             //Output
  53.             Console.WriteLine("\n\n\n");
  54.             Console.WriteLine(custName);
  55.             Console.WriteLine(custStreet);
  56.             Console.WriteLine("{0}, {1} {2}\n", custCity, custState, custZip);
  57.             Console.WriteLine("Number of blenders ordered: {0}\n\n", custNoBlenders);
  58.  
  59.             Console.WriteLine("Subtotal:\t{0}",custSubTotal.ToString("c"));
  60.             Console.WriteLine("Tax:\t\t{0}",custTax.ToString("c"));
  61.             Console.WriteLine("--------------------");
  62.             Console.WriteLine("Total Due:\t{0}",custTotal.ToString("c"));
  63.  
  64.  
  65.  
  66.  
  67.             Console.ReadLine();
  68.  
  69.         }
  70.  
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement