Advertisement
optybg

Untitled

Feb 7th, 2017
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Harvest_02
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             float vineyard = int.Parse(Console.ReadLine());
  10.             float grapePerSquare = float.Parse(Console.ReadLine());
  11.             float wineNeed = int.Parse(Console.ReadLine());
  12.             float workers = int.Parse(Console.ReadLine());
  13.            
  14.             float totalGrape = vineyard*grapePerSquare;
  15.             double totalWine = (double)totalGrape*(40.0/100)/2.5;
  16.            
  17.             if (totalWine >= wineNeed)
  18.             {
  19.                 Console.WriteLine("Good harvest this year! Total wine: {0} liters.", Math.Floor(totalWine));
  20.                 Console.WriteLine("{0} liters left -> {1} liters per person.", Math.Ceiling(totalWine-wineNeed), Math.Ceiling((totalWine-wineNeed)/workers));
  21.             }
  22.             else
  23.             {
  24.                 Console.WriteLine("It will be a tough winter! More {0} liters wine needed.", Math.Floor(Math.Abs(totalWine-wineNeed)));
  25.             }
  26.            
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement