Advertisement
dbunalov

02.Harvest

Jul 20th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02.Harvest
  4. {
  5.     class Harvest
  6.     {
  7.         static void Main()
  8.         {            
  9.             var x = int.Parse(Console.ReadLine());//total sq.meters
  10.             var y = double.Parse(Console.ReadLine());//grape for sq.meter
  11.             var z = int.Parse(Console.ReadLine());//needed wine liters
  12.             var empl = int.Parse(Console.ReadLine());//total employees
  13.  
  14.             double grape = x * y; //total grape from sq.meters;
  15.             double grapeForWine = grape * 0.4;
  16.             double wine = grapeForWine / 2.5;
  17.             double wineMore = wine - z;
  18.             double wineLess = z - wine;
  19.  
  20.  
  21.             if (z > wine)
  22.             {
  23.                 Console.WriteLine($"It will be a tough winter! More {Math.Floor(wineLess)} liters wine needed.");
  24.             }
  25.             else if (wine >= z)
  26.             {
  27.                 Console.WriteLine($"Good harvest this year! Total wine: {Math.Floor(wine)} liters.");
  28.                 //Console.WriteLine($"{wineMore} liters left -> {Math.Ceiling(wineMore/empl)} liters per person.");//Not correct
  29.                 Console.WriteLine($"{Math.Ceiling(wineMore)} liters left -> {Math.Ceiling(wineMore/empl)} liters per person.");//Correct
  30.                 //The little fucking bug is {wimeMore} it should be {Math.Ceiling(wineMore)}
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement