Advertisement
bpavlov123bp

FruitMarket

Apr 6th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FruitMarket
  4. {
  5. class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. var fruit = Console.ReadLine().ToLower();
  10. var dayOfWeek = Console.ReadLine().ToLower();
  11. var quantity = double.Parse(Console.ReadLine());
  12. double price = -1;
  13. double total = 0;
  14. if(dayOfWeek == "monday" || dayOfWeek == "tuesday" || dayOfWeek == "wednesday" || dayOfWeek == "thursday" || dayOfWeek == "friday")
  15. {
  16. if(fruit == "banana") price = 2.50;
  17. else if(fruit == "apple") price = 1.20;
  18. else if(fruit == "orange") price = 0.85;
  19. else if(fruit == "grapefruit") price = 1.45;
  20. else if(fruit == "kiwi") price = 2.70;
  21. else if(fruit == "pineapple") price = 5.50;
  22. else if(fruit == "grapes") price = 3.85;
  23. }
  24. if(dayOfWeek == "saturday" || dayOfWeek == "sunday")
  25. {
  26. if(fruit == "banana") price = 2.70;
  27. else if(fruit == "apple") price = 1.25;
  28. else if(fruit == "orange") price = 0.90;
  29. else if(fruit == "grapefruit") price = 1.60;
  30. else if(fruit == "kiwi") price = 3.00;
  31. else if(fruit == "pineapple") price = 5.60;
  32. else if(fruit == "grapes") price = 4.20;
  33. }
  34. if(price <= 0)
  35. {
  36. Console.WriteLine("error");
  37. }
  38. else
  39. {
  40. total = price * quantity;
  41. Console.WriteLine("{0:f2}", total);
  42. }
  43. Console.Write("Press any key to continue . . . ");
  44. Console.ReadKey(true);
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement