Advertisement
Guest User

Untitled

a guest
Sep 20th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. namespace SquareOfStars
  2. {
  3. using System;
  4.  
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string fruit = Console.ReadLine().ToLower();
  10. string dayOfTheWeek = Console.ReadLine().ToLower();
  11. double num = double.Parse(Console.ReadLine());
  12. double result = 0;
  13. double price=-1;
  14. if (dayOfTheWeek == "monday" ||
  15. dayOfTheWeek == "tuesday" ||
  16. dayOfTheWeek == "wednesday" ||
  17. dayOfTheWeek == "thursday" ||
  18. dayOfTheWeek == "friday")
  19. {
  20. if (fruit == "banana")
  21. {
  22. price=2.5d;
  23. }
  24. else if (fruit == "apple")
  25. {
  26. price=1.2d;
  27. }
  28. else if (fruit == "orange")
  29. {
  30. price=0.85d;
  31. }
  32. else if (fruit == "grapefruit")
  33. {
  34. price=1.45d;
  35. }
  36. else if (fruit == "kiwi")
  37. {
  38. price=2.7d;
  39. }
  40. else if (fruit == "pineapple")
  41. {
  42. price=5.5d;
  43. }
  44. else if (fruit == "grapes")
  45. {
  46. price=3.85d;
  47. }
  48. }
  49. else if (dayOfTheWeek == "sunday" ||
  50. dayOfTheWeek == "saturday")
  51. {
  52. if (fruit == "banana")
  53. {
  54. price=2.7d;
  55. }
  56. else if (fruit == "apple")
  57. {
  58. price=1.25d;
  59. }
  60. else if (fruit == "orange")
  61. {
  62. price=0.9d;
  63. }
  64. else if (fruit == "grapefruit")
  65. {
  66. price=1.6d;
  67. }
  68. else if (fruit == "kiwi")
  69. {
  70. price=3.0d;
  71. }
  72. else if (fruit == "pineapple")
  73. {
  74. price=5.6d;
  75. }
  76. else if (fruit == "grapes")
  77. {
  78. price=4.2d;
  79.  
  80. }
  81. }
  82.  
  83. if(price!=-1)
  84. {
  85. result=price*num;
  86. Console.WriteLine("{0:f2}", result);
  87. }
  88. else{
  89. Console.WriteLine("error");
  90. }
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement