Advertisement
Guest User

Untitled

a guest
Nov 30th, 2013
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using System.Globalization;
  4.  
  5. class Garden
  6. {
  7.     static void Main(string[] args)
  8.     {
  9.         short tomatoSeeds = short.Parse(Console.ReadLine());
  10.         byte tomatoArea = byte.Parse(Console.ReadLine());
  11.         short cucumberSeeds = short.Parse(Console.ReadLine());
  12.         byte cucumberArea = byte.Parse(Console.ReadLine());
  13.         short potatoSeeds = short.Parse(Console.ReadLine());
  14.         byte potatoArea = byte.Parse(Console.ReadLine());
  15.         short carrotSeeds = short.Parse(Console.ReadLine());
  16.         byte carrotArea = byte.Parse(Console.ReadLine());
  17.         short cabbageSeeds = short.Parse(Console.ReadLine());
  18.         byte cabageArea = byte.Parse(Console.ReadLine());
  19.         short beansSeeds = short.Parse(Console.ReadLine());
  20.  
  21.         int vegetablesArea = tomatoArea + cucumberArea + potatoArea + carrotArea + cabageArea;
  22.  
  23.         decimal vegetablesPrice = (tomatoSeeds * 0.50m) + (cucumberSeeds * 0.40m) + (potatoSeeds * 0.25m)
  24.             + (carrotSeeds * 0.60m) + (cabbageSeeds * 0.30m) + (beansSeeds * 0.40m);
  25.         Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
  26.         Console.WriteLine("Total costs: {0:N}", vegetablesPrice);
  27.  
  28.         if (vegetablesArea < 250)
  29.         {
  30.             int beansArea = 250 - vegetablesArea;
  31.             Console.WriteLine("Beans area: {0}", beansArea);
  32.         }
  33.         if (vegetablesArea > 250)
  34.         {
  35.              
  36.             Console.WriteLine("Insufficient area");
  37.         }
  38.         if (vegetablesArea == 250)
  39.         {
  40.             Console.WriteLine("No area for beans");
  41.         }
  42.  
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement