Advertisement
ivan_yosifov

Garden

Nov 13th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using System;
  2.  
  3. class Garden
  4. {
  5.     static void Main()
  6.     {
  7.         int tomatoSeeds = int.Parse(Console.ReadLine());
  8.         int tomatoArea = int.Parse(Console.ReadLine());
  9.  
  10.         int cucumberSeeds = int.Parse(Console.ReadLine());
  11.         int cucumberArea = int.Parse(Console.ReadLine());
  12.  
  13.         int potatoSeeds = int.Parse(Console.ReadLine());
  14.         int potatoArea = int.Parse(Console.ReadLine());
  15.  
  16.         int carrotSeeds = int.Parse(Console.ReadLine());
  17.         int carrotArea = int.Parse(Console.ReadLine());
  18.  
  19.         int cabbageSeeds = int.Parse(Console.ReadLine());
  20.         int cabbageArea = int.Parse(Console.ReadLine());
  21.  
  22.         int beansSeeds = int.Parse(Console.ReadLine());
  23.  
  24.         int totalArea = 250;
  25.         int mainArea = (tomatoArea + cucumberArea + potatoArea +
  26.                         carrotArea + cabbageArea);
  27.         int beansArea = 0;
  28.  
  29.         decimal tomatoCost = 0.5M;
  30.         decimal cucumberCost = 0.4M;
  31.         decimal potatoCost = 0.25M;
  32.         decimal carrotCost = 0.6M;
  33.         decimal cabbageCost = 0.3M;
  34.         decimal beansCost = 0.4M;
  35.  
  36.         decimal totalCost = (tomatoSeeds * tomatoCost) +
  37.                             (cucumberSeeds * cucumberCost) +
  38.                             (potatoSeeds * potatoCost) +
  39.                             (carrotSeeds * carrotCost) +
  40.                             (cabbageSeeds * cabbageCost) +
  41.                             (beansSeeds * beansCost);
  42.  
  43.         Console.WriteLine("Total costs: {0}", totalCost);
  44.  
  45.         if (totalArea >= mainArea)
  46.         {
  47.             beansArea = totalArea - mainArea;
  48.             if (beansArea != 0)
  49.             {
  50.                 Console.WriteLine("Beans area: {0}", beansArea);
  51.             }
  52.             else
  53.             {
  54.                 Console.WriteLine("No area for beans");
  55.             }
  56.         }
  57.         else
  58.         {
  59.             Console.WriteLine("Insufficient area");
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement