Guest User

Untitled

a guest
Oct 17th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 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 FruitShop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var fruit = Console.ReadLine();
  14. var day = Console.ReadLine();
  15. var quantity = double.Parse(Console.ReadLine());
  16. var price = -1.0;
  17.  
  18. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  19. {
  20. if (fruit == "banana")
  21. {
  22. price = 2.50;
  23. }
  24. else if (fruit == "apple")
  25. {
  26. price = 1.20;
  27. }
  28. else if (fruit == "orange")
  29. {
  30. price = 0.85;
  31. }
  32. else if (fruit == "grapefruit")
  33. {
  34. price = 1.45;
  35. }
  36. else if (fruit == "kiwi")
  37. {
  38. price = 2.70;
  39. }
  40. else if (fruit == "pineapple")
  41. {
  42. price = 5.50;
  43. }
  44. else if (fruit == "grapes")
  45. {
  46. price = 3.85;
  47. }
  48. }
  49. else if (day == "Saturday" || day == "Sunday")
  50. {
  51. if (fruit == "banana")
  52. {
  53. price = 2.70;
  54. }
  55. else if (fruit == "apple")
  56. {
  57. price = 1.25;
  58. }
  59. else if (fruit == "orange")
  60. {
  61. price = 0.90;
  62. }
  63. else if (fruit == "grapefruit")
  64. {
  65. price = 1.60;
  66. }
  67. else if (fruit == "kiwi")
  68. {
  69. price = 3.00;
  70. }
  71. else if (fruit == "pineapple")
  72. {
  73. price = 5.60;
  74. }
  75. else if (fruit == "grapes")
  76. {
  77. price = 4.20;
  78. }
  79. }
  80. if (price >= 0)
  81. {
  82. Console.WriteLine("{0:f2}", price * quantity);
  83. }
  84. else
  85. {
  86. Console.WriteLine("error");
  87. }
  88.  
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment