Advertisement
silvana1303

harvest

Mar 24th, 2020
209
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. namespace silvanadoc
  7. {
  8.     class silvanadoc
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int yard = int.Parse(Console.ReadLine());
  13.             double berries = double.Parse(Console.ReadLine());
  14.             int wantedWine = int.Parse(Console.ReadLine());
  15.             int workers = int.Parse(Console.ReadLine());
  16.  
  17.             double allBerries = yard * berries;
  18.             double producedWine = (allBerries * 0.4) / 2.5;
  19.             double neededWine = wantedWine - producedWine;
  20.             double leftWine = producedWine - wantedWine;
  21.             double spredWine = leftWine / workers;
  22.  
  23.             if (producedWine < wantedWine)
  24.             {
  25.                 Console.WriteLine($"It will be a tough winter! More {Math.Floor(neededWine)} liters wine needed.");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"Good harvest this year! Total wine: {Math.Floor(producedWine)} liters.");
  30.                 Console.WriteLine($"{Math.Ceiling(leftWine)} liters left -> {Math.Ceiling(spredWine)} liters per person.");
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement