BorislavBorisov

17.02.Garden мое решение

Nov 8th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. class Garden
  3. {
  4.     static void Main()
  5.     {
  6.         int area = 0;
  7.         decimal seedsCosts = 0m;
  8.         SumOfSeedsCost(seedsCosts, area);
  9.     }
  10.  
  11.     static void SumOfSeedsCost(decimal seedsCosts, int area)
  12.     {
  13.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.5m;//няма смисъл да правим отделни променливи
  14.         area += byte.Parse(Console.ReadLine());
  15.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.4m;
  16.         area += byte.Parse(Console.ReadLine());
  17.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.25m;
  18.         area += byte.Parse(Console.ReadLine());
  19.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.6m;
  20.         area += byte.Parse(Console.ReadLine());
  21.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.3m;
  22.         area += byte.Parse(Console.ReadLine());
  23.         seedsCosts += decimal.Parse(Console.ReadLine()) * 0.4m;
  24.         if(area - 250 == 0)
  25.         {
  26.             Console.WriteLine("Total costs: " + seedsCosts);
  27.             Console.WriteLine("No area for beans");
  28.         }
  29.         else if(area > 250)
  30.         {
  31.             Console.WriteLine("Total costs: " + seedsCosts);
  32.             Console.WriteLine("Insufficient area");
  33.         }
  34.         else
  35.         {
  36.             Console.WriteLine("Total costs: " + seedsCosts);
  37.             Console.WriteLine("Beans area: " + (250 - area));
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment