Advertisement
Niicksana

Harvest

Dec 3rd, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 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 Rekolta
  8. {
  9.     class Harvest
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 17 July 2016
  14.             int X = int.Parse(Console.ReadLine());
  15.             double Y = double.Parse(Console.ReadLine());
  16.             int Z = int.Parse(Console.ReadLine());
  17.             int workers = int.Parse(Console.ReadLine());
  18.  
  19.             double percentage = X * 0.40;
  20.             double kg = percentage * Y;
  21.             double wineLiters = kg / 2.5;
  22.            
  23.             if (wineLiters < Z)
  24.             {
  25.                 double wineLacked = Math.Floor(Z - wineLiters);
  26.                 Console.WriteLine("It will be a tough winter! More {0:0} liters wine needed.", wineLacked);
  27.             }
  28.            
  29.             else
  30.             {
  31.                 Console.WriteLine("Good harvest this year! Total wine: {0} liters.", Math.Floor(wineLiters));
  32.                 double wineLeft = Math.Ceiling(wineLiters - Z);
  33.                 double winePerPerson = Math.Ceiling(wineLeft / workers);
  34.                
  35.                 Console.WriteLine("{0} liters left -> {1} liters per person.", wineLeft, winePerPerson);
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement