Advertisement
Guest User

Harvest

a guest
Sep 26th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Produce
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var area = int.Parse(Console.ReadLine());
  14.             var grapesKGPerSQM = double.Parse(Console.ReadLine());
  15.             var wineNeeded = double.Parse(Console.ReadLine());
  16.             var workers = double.Parse(Console.ReadLine());
  17.             var harvestForWine = (area * grapesKGPerSQM)*0.4;
  18.             var wine = harvestForWine / 2.5;
  19.             var totalWine = Math.Truncate(wine);
  20.  
  21.             if (wine < wineNeeded)
  22.             {
  23.                 Console.WriteLine("It will be a tough winter! More {0} liters wine needed.",
  24.                 Math.Truncate(wineNeeded-wine));
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine("Good harvest this year! Total wine: {0} liters.",
  29.                    Math.Truncate(wine));
  30.                 Console.WriteLine("{0} liters left -> {1} liters per person.",
  31.                     Math.Round(totalWine-wineNeeded),
  32.                     Math.Round((totalWine - wineNeeded)/workers));
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement