using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace mehonatmash { class Program { static void Main(string[] args) { double add , excess; Console.WriteLine("the beverage machine menu: "); Console.WriteLine("1.Instant Coffe(1)..2.40"); Console.WriteLine("2.Black Coffe(2)....2.10"); Console.WriteLine("3.Tea(3)............1.60"); Console.WriteLine("4.Shoko(4)..........2.50"); Console.WriteLine("5.Soup(5)...........3.10"); Console.WriteLine("6.Cola(6)...........3.30"); Console.WriteLine("7.Orange Juice(7)...3.20"); Console.Write("Enter the code of the drink you want to buy---> "); int code = int.Parse(Console.ReadLine()); Console.Write("Enter the amount of money--> "); double mon = double.Parse(Console.ReadLine()); if(code == 1) { if(mon - 2.40 == 0) { Console.WriteLine("you chose the beverage Instant Coffe that its price is 2.40, thank you for using our machine"); } else if(mon - 2.40 < 0) { add = mon - 2.40; 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 ); } else if (mon - 2.40 > 0) { excess = mon - 2.40; if(excess % 20 == 0) Console.WriteLine("you chose the beverage Instant Coffe that its price is 2.40"); Console.WriteLine("you are going to get excess of "); } } if (code == 2) { if (mon - 2.10 == 0) { Console.WriteLine("you chose the beverage Black Coffe that its price is 2.10, thank you for using our machine"); } else if (mon - 2.10 < 0) { add = mon - 2.10; 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); } else if (mon - 2.10 > 0) { excess = mon - 2.10; Console.WriteLine("you chose the beverage Black Coffe that its price is 2.10"); } } if (code == 3) { if (mon - 1.60 == 0) { Console.WriteLine("you chose the beverage Tea that its price is 1.60, thank you for using our machine"); } else if (mon - 1.60 < 0) { add = mon - 1.60; 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); } else if (mon - 1.60 > 0) { excess = mon - 1.60; Console.WriteLine("you chose the beverage Tea that its price is 1.60"); } } if (code == 4) { if (mon - 2.50 == 0) { Console.WriteLine("you chose the beverage Shoko that its price is 2.50, thank you for using our machine"); } else if (mon - 2.50 < 0) { add = mon - 2.50; 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); } else if (mon - 2.50 > 0) { excess = mon - 2.50; Console.WriteLine("you chose the beverage Shoko that its price is 2.50"); } } if (code == 5) { if (mon - 3.10 == 0) { Console.WriteLine("you chose the beverage Soup that its price is 3.10, thank you for using our machine"); } else if (mon - 3.10 < 0) { add = mon - 3.10; 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); } else if (mon - 3.10 > 0) { excess = mon - 3.10; Console.WriteLine("you chose the beverage Soup that its price is 3.10"); } } if (code == 6) { if (mon - 3.30 == 0) { Console.WriteLine("you chose the beverage Cola that its price is 3.30, thank you for using our machine"); } else if (mon - 3.30 < 0) { add = mon - 3.30; 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); } else if (mon - 3.30 > 0) { excess = mon - 3.30; Console.WriteLine("you chose the beverage Cola that its price is 3.30"); } } if (code == 7) { if (mon - 3.20 == 0) { Console.WriteLine("you chose the beverage Orange Juice that its price is 3.20, thank you for using our machine"); } else if (mon - 3.20 < 0) { add = mon - 3.20; 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); } else if (mon - 3.20 > 0) { excess = mon - 3.20; Console.WriteLine("you chose the beverage Orange Juice that its price is 3.20"); } } } } }