Facebook
From Hhh, 3 Years ago, written in C.
Embed
Download Paste or View Raw
Hits: 92
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace mehonatmash
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double add , excess;
  14.             Console.WriteLine("the beverage machine menu: ");
  15.             Console.WriteLine("1.Instant Coffe(1)..2.40");
  16.             Console.WriteLine("2.Black Coffe(2)....2.10");
  17.             Console.WriteLine("3.Tea(3)............1.60");
  18.             Console.WriteLine("4.Shoko(4)..........2.50");
  19.             Console.WriteLine("5.Soup(5)...........3.10");
  20.             Console.WriteLine("6.Cola(6)...........3.30");
  21.             Console.WriteLine("7.Orange Juice(7)...3.20");
  22.             Console.Write("Enter the code of the drink you want to buy---> ");
  23.             int code = int.Parse(Console.ReadLine());
  24.             Console.Write("Enter the amount of money--> ");
  25.             double mon = double.Parse(Console.ReadLine());
  26.             if(code == 1)
  27.             {
  28.                 if(mon - 2.40 == 0)
  29.                 {
  30.                     Console.WriteLine("you chose the beverage Instant Coffe that its price is 2.40, thank you for using our machine");
  31.                 }
  32.                 else if(mon - 2.40 < 0)
  33.                 {
  34.                     add = mon - 2.40;
  35.                     Console.WriteLine("you chose the beverage Instant Coffe that its price is 2.40 but you entered only: " + mon + " the amount of money you need to add is: " + add );
  36.                 }
  37.                 else if (mon - 2.40 > 0)
  38.                 {
  39.                     excess = mon - 2.40;
  40.                     if(excess % 20 == 0)
  41.                     Console.WriteLine("you chose the beverage Instant Coffe that its price is 2.40");
  42.                     Console.WriteLine("you are going to get excess of ");
  43.                 }
  44.             }
  45.             if (code == 2)
  46.             {
  47.                 if (mon - 2.10 == 0)
  48.                 {
  49.                     Console.WriteLine("you chose the beverage Black Coffe that its price is 2.10, thank you for using our machine");
  50.                 }
  51.                 else if (mon - 2.10 < 0)
  52.                 {
  53.                     add = mon - 2.10;
  54.                     Console.WriteLine("you chose the beverage Black Coffe that its price is 2.10 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  55.                 }
  56.                 else if (mon - 2.10 > 0)
  57.                 {
  58.                     excess = mon - 2.10;
  59.                     Console.WriteLine("you chose the beverage Black Coffe that its price is 2.10");
  60.                 }
  61.             }
  62.             if (code == 3)
  63.             {
  64.                 if (mon - 1.60 == 0)
  65.                 {
  66.                     Console.WriteLine("you chose the beverage Tea that its price is 1.60, thank you for using our machine");
  67.                 }
  68.                 else if (mon - 1.60 < 0)
  69.                 {
  70.                     add = mon - 1.60;
  71.                     Console.WriteLine("you chose the beverage Tea that its price is 1.60 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  72.                 }
  73.                 else if (mon - 1.60 > 0)
  74.                 {
  75.                     excess = mon - 1.60;
  76.                     Console.WriteLine("you chose the beverage Tea that its price is 1.60");
  77.                 }
  78.             }
  79.             if (code == 4)
  80.             {
  81.                 if (mon - 2.50 == 0)
  82.                 {
  83.                     Console.WriteLine("you chose the beverage Shoko that its price is 2.50, thank you for using our machine");
  84.                 }
  85.                 else if (mon - 2.50 < 0)
  86.                 {
  87.                     add = mon - 2.50;
  88.                     Console.WriteLine("you chose the beverage Shoko that its price is 2.50 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  89.                 }
  90.                 else if (mon - 2.50 > 0)
  91.                 {
  92.                     excess = mon - 2.50;
  93.                     Console.WriteLine("you chose the beverage Shoko that its price is 2.50");
  94.                 }
  95.             }
  96.             if (code == 5)
  97.             {
  98.                 if (mon - 3.10 == 0)
  99.                 {
  100.                     Console.WriteLine("you chose the beverage Soup that its price is 3.10, thank you for using our machine");
  101.                 }
  102.                 else if (mon - 3.10 < 0)
  103.                 {
  104.                     add = mon - 3.10;
  105.                     Console.WriteLine("you chose the beverage Soup that its price is 3.10 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  106.                 }
  107.                 else if (mon - 3.10 > 0)
  108.                 {
  109.                     excess = mon - 3.10;
  110.                     Console.WriteLine("you chose the beverage Soup that its price is 3.10");
  111.                 }
  112.             }
  113.             if (code == 6)
  114.             {
  115.                 if (mon - 3.30 == 0)
  116.                 {
  117.                     Console.WriteLine("you chose the beverage Cola that its price is 3.30, thank you for using our machine");
  118.                 }
  119.                 else if (mon - 3.30 < 0)
  120.                 {
  121.                     add = mon - 3.30;
  122.                     Console.WriteLine("you chose the beverage Cola that its price is 3.30 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  123.                 }
  124.                 else if (mon - 3.30 > 0)
  125.                 {
  126.                     excess = mon - 3.30;
  127.                     Console.WriteLine("you chose the beverage Cola that its price is 3.30");
  128.                 }
  129.             }
  130.             if (code == 7)
  131.             {
  132.                 if (mon - 3.20 == 0)
  133.                 {
  134.                     Console.WriteLine("you chose the beverage Orange Juice that its price is 3.20, thank you for using our machine");
  135.                 }
  136.                 else if (mon - 3.20 < 0)
  137.                 {
  138.                     add = mon - 3.20;
  139.                     Console.WriteLine("you chose the beverage Orange Juice that its price is 3.20 but you entered only: " + mon + " the amount of money you need to add is: " + add);
  140.                 }
  141.                 else if (mon - 3.20 > 0)
  142.                 {
  143.                     excess = mon - 3.20;
  144.                     Console.WriteLine("you chose the beverage Orange Juice that its price is 3.20");
  145.                 }
  146.             }
  147.         }
  148.     }
  149. }