Advertisement
Guest User

c# Kafemashina

a guest
Mar 29th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string drink = Console.ReadLine();
  13. string sugar = Console.ReadLine();
  14. int countOfDrinks = int.Parse(Console.ReadLine());
  15. double price = 0;
  16. // double totalPrice = 0;
  17.  
  18. if (drink == "Espresso")
  19. {
  20. if (sugar == "Without")
  21. {
  22. price = countOfDrinks * 0.9;
  23. price = price - price * 0.35;
  24. }
  25. else if (sugar == "Normal") price = countOfDrinks * 1;
  26. else if (sugar == "Extra") price = countOfDrinks * 1.2;
  27. if (countOfDrinks >= 5) price = price - price * 0.25;
  28. if (price > 15) price = price - price * 0.2;
  29. }
  30. else
  31. {
  32. if (drink == "Tea")
  33. {
  34. if (sugar == "Without")
  35. {
  36. price = countOfDrinks * 0.5;
  37. price = price - price * 0.35;
  38. }
  39. else if (sugar == "Normal") price = countOfDrinks * 0.6;
  40. else if (sugar == "Extra") price = countOfDrinks * 0.7;
  41. if (price > 15) price = price - price * 0.2;
  42. }
  43.  
  44. else
  45. {
  46. if (drink == "Cappuccino")
  47. {
  48. if (sugar == "Without")
  49. {
  50. price = countOfDrinks * 1;
  51. price = price - price * 0.35;
  52. }
  53. else if (sugar == "Normal") price = countOfDrinks * 1.2;
  54. else if (sugar == "Extra") price = countOfDrinks * 1.6;
  55. if (price > 15) price = price - price * 0.2;
  56. }
  57. }
  58. }
  59. Console.WriteLine("You bought {0} cups of {1} for {2:F2}lv.", countOfDrinks, drink, price);
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement