Advertisement
svetoslavhl

Garden

May 20th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. int tomatoSeeds = int.Parse(Console.ReadLine());
  8. int tomatoArea = int.Parse(Console.ReadLine());
  9. decimal tomatoCost = 0.50m;
  10.  
  11. int cucumberSeeds = int.Parse(Console.ReadLine());
  12. int cucumberArea = int.Parse(Console.ReadLine());
  13. decimal cucumberCost = 0.40m;
  14.  
  15. int potatoSeeds = int.Parse(Console.ReadLine());
  16. int potatoArea = int.Parse(Console.ReadLine());
  17. decimal potatoCost = 0.25m;
  18.  
  19. int carrotSeeds = int.Parse(Console.ReadLine());
  20. int carrotArea = int.Parse(Console.ReadLine());
  21. decimal carrotCost = 0.60m;
  22.  
  23. int cabbageSeeds = int.Parse(Console.ReadLine());
  24. int cabbageArea = int.Parse(Console.ReadLine());
  25. decimal cabbageCost = 0.30m;
  26.  
  27. int beansSeeds = int.Parse(Console.ReadLine());
  28.  
  29. decimal beansCost = 0.40m;
  30.  
  31. decimal totalPrice = (tomatoSeeds * tomatoCost) + (cucumberSeeds * cucumberCost) + (potatoSeeds * potatoCost) + (carrotSeeds * carrotCost) + (cabbageSeeds * cabbageCost) + (beansSeeds*beansCost);
  32. int totalArea = tomatoArea + cucumberArea + potatoArea + carrotArea + cabbageArea;
  33.  
  34. int areaAvailable = 250;
  35. int areaBeans = areaAvailable - totalArea;
  36.  
  37. if (areaBeans > 0) {
  38.  
  39. Console.WriteLine("Total costs: {0:0.00}", totalPrice);
  40. Console.WriteLine("Beans area: {0}", areaBeans);
  41. }
  42.  
  43. if (totalArea > areaAvailable) {
  44.  
  45. Console.WriteLine("Total costs: {0:0.00}", totalPrice);
  46. Console.WriteLine("Insufficent area");
  47.  
  48. }
  49.  
  50. if (areaBeans <= 0 && areaAvailable >= totalArea ) {
  51. Console.WriteLine("Total costs: {0:0.00}", totalPrice);
  52. Console.WriteLine("No area for beans");
  53.  
  54. }
  55.  
  56.  
  57.  
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement