rado84

FruitShop-Problem

Jun 9th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 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.  
  14. var fruit = Console.ReadLine();
  15. var day = Console.ReadLine();
  16. double quantity = double.Parse(Console.ReadLine());
  17. double price;
  18.  
  19.  
  20. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Tuesday" || day == "Friday")
  21. {
  22. if (fruit == "banana")
  23. { price = 2.50; Console.WriteLine("{0:0.##}", quantity * price); }
  24.  
  25. else if (fruit == "apple")
  26. { price = 1.20; Console.WriteLine("{0:0.##}", quantity * price); }
  27.  
  28. else if (fruit == "orange")
  29. { price = 0.85; Console.WriteLine("{0:0.##}", quantity * price); }
  30.  
  31. else if (fruit == "grapefruit")
  32. { price = 1.45; Console.WriteLine("{0:0.##}", quantity * price); }
  33.  
  34. else if (fruit == "kiwi")
  35. { price = 2.70; Console.WriteLine("{0:0.##}", quantity * price); }
  36.  
  37. else if (fruit == "pineapple")
  38. { price = 5.50; Console.WriteLine("{0:0.##}", quantity * price); }
  39.  
  40. else if (fruit == "grapes")
  41. { price = 3.85; Console.WriteLine("{0:0.##}", quantity * price); }
  42.  
  43. else { Console.WriteLine("error"); }
  44. }
  45.  
  46.  
  47. else if (day == "Saturday" || day == "Sunday")
  48. {
  49. if (fruit == "banana")
  50. { price = 2.70; Console.WriteLine("{0:0.##}", quantity * price); }
  51.  
  52. else if (fruit == "apple")
  53. { price = 1.25; Console.WriteLine("{0:0.##}", quantity * price); }
  54.  
  55. else if (fruit == "orange")
  56. { price = 0.90; Console.WriteLine("{0:0.##}", quantity * price); }
  57.  
  58. else if (fruit == "grapefruit")
  59. { price = 1.60; Console.WriteLine("{0:0.##}", quantity * price); }
  60.  
  61. else if (fruit == "kiwi")
  62. { price = 3.00; Console.WriteLine("{0:0.##}", quantity * price); }
  63.  
  64. else if (fruit == "pineapple")
  65. { price = 5.60; Console.WriteLine("{0:0.##}", quantity * price); }
  66.  
  67. else if (fruit == "grapes")
  68. { price = 4.20; Console.WriteLine("{0:0.##}", quantity * price); }
  69.  
  70. else { Console.WriteLine("error"); }
  71. }
  72.  
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment