Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.91 KB | None | 0 0
  1. namespace desktop
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             //Make red (red=good)
  8.             //Welcome to shop
  9.             //Declare all variables
  10.             //Ask name
  11.             //Ask price doubles (if possable try convert from int??)
  12.             //Ask if continue shopping
  13.                 //Ask price for second item if true
  14.             //Add prices and calucate gst
  15.             //Print price  
  16.             //Print “Thank you for shopping with us (var name), please come again”
  17.             //Clear red
  18.  
  19.                         Console.Clear();
  20.             Console.ForegroundColor = ConsoleColor.Red;
  21.            
  22.  
  23.             var int2 = 0;
  24.             var item1 = 0.00;
  25.             var item2 = 0.00;
  26.  
  27.              
  28.             Console.WriteLine("Hello welcome to my shop");
  29.             Console.WriteLine("What is your name?");
  30.             var name = (Console.ReadLine());
  31.             Console.WriteLine($"please enter the price of your item");
  32.             Double.TryParse(Console.ReadLine(), out item1);
  33.             {
  34.                 Console.WriteLine($"{item1}");
  35.             }
  36.             Console.WriteLine("would you like to add another item? (y/n)");
  37.             var addItem = Console.ReadLine();
  38.             if (addItem == "y");
  39.             {
  40.                 Console.WriteLine($"please enter the price of your item");
  41.                  int2 = Double.TryParse(Console.ReadLine(), out item2);
  42.                 {
  43.                     Console.WriteLine($"{item2}");
  44.                 }  
  45.             }
  46.             double totalPrice = (item1 + item2);
  47.             totalPrice = totalPrice+(totalPrice*0.15);
  48.             totalPrice = (Double)totalPrice;
  49.             Console.WriteLine($"${totalPrice}");
  50.             Console.WriteLine($"thank you for shopping with us {name}");  
  51.  
  52.  
  53.             Console.ResetColor();
  54.             Console.WriteLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement