nvnnaidenov

Harvest - Chapter 3.1

Feb 10th, 2022
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. //Task 004, Chapter 3.1
  2. using System;
  3.  
  4. public class Harvest
  5. {
  6.     static void Main()
  7.     {
  8.         int area = int.Parse(Console.ReadLine());
  9.         double grapes = double.Parse(Console.ReadLine());
  10.         int neededLiters = int.Parse(Console.ReadLine());
  11.         int workers = int.Parse(Console.ReadLine());
  12.  
  13.         double harvestPerVine = area * grapes * 0.40;
  14.         double vine = harvestPerVine / 2.5;
  15.  
  16.         if(vine >= neededLiters)
  17.         {
  18.             double leftVine = vine - neededLiters;
  19.             Console.WriteLine($"Good harvest this year! Total wine: {Math.Floor(vine)} liters.");
  20.             Console.WriteLine($"{Math.Ceiling(leftVine)} liters left -> {Math.Ceiling(leftVine / workers)} liters per person.");
  21.         }
  22.         else
  23.         {
  24.             Console.WriteLine($"It will be a tough winter! More {Math.Floor(neededLiters - vine)} liters wine needed.");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment