Advertisement
plamen27

Fruit shop fixed

Jul 4th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 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 Fruit_Shop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string fruit = Console.ReadLine();
  14. string day = Console.ReadLine();
  15. var quantity = double.Parse(Console.ReadLine());
  16. var price = 0.0;
  17.  
  18. if (day == "Saturday" || day == "Sunday")
  19. {
  20. if (fruit == "banana") price = 2.70;
  21. else if (fruit == "apple") price = 1.25;
  22. else if (fruit == "orange") price = 0.90;
  23. else if (fruit == "grapefruit") price = 1.60;
  24. else if (fruit == "kiwi") price = 3.00;
  25. else if (fruit == "pineapple") price = 5.60;
  26. else if (fruit == "grapes") price = 4.20;
  27. else
  28. { Console.WriteLine("error");}
  29.  
  30. }
  31.  
  32. else if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  33. {
  34. if (fruit == "banana") price = 2.50;
  35. else if (fruit == "apple") price = 1.20;
  36. else if (fruit == "orange") price = 0.85;
  37. else if (fruit == "grapefruit") price = 1.45;
  38. else if (fruit == "kiwi") price = 2.70;
  39. else if (fruit == "pineapple") price = 5.50;
  40. else if (fruit == "grapes") price = 3.85;
  41. else
  42. { Console.WriteLine("error");}
  43. }
  44.  
  45. else
  46. {
  47. Console.WriteLine("error");
  48.  
  49. }
  50.  
  51. Console.WriteLine("{0:f2}", (price * quantity));
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement