Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Harvest
- {
- static void Main()
- {
- int x = int.Parse(Console.ReadLine());
- double y = double.Parse(Console.ReadLine());
- int z = int.Parse(Console.ReadLine());
- int numberOfWorkers = int.Parse(Console.ReadLine());
- double totalGrapes = x * y;
- double totalWine = (totalGrapes * 0.4) / 2.5;
- double litersLeft = totalWine - z;
- double litersPerPerson = litersLeft / numberOfWorkers;
- double wineNeeded = z - totalWine;
- double wineNededRounded = Math.Truncate(wineNeeded);
- double totalWineFloor = Math.Floor(totalWine);
- double litersLeftCeilling = Math.Ceiling(litersLeft);
- double litersLeftPerPersonCeilling = Math.Ceiling(litersPerPerson);
- if (totalWine > z)
- {
- Console.WriteLine("Good harvest this year! Total wine: {0} liters.", totalWineFloor);
- Console.WriteLine("{0} liters left -> {1} liters per person.", litersLeftCeilling, litersLeftPerPersonCeilling);
- }
- else
- {
- Console.WriteLine("It will be a tough winter! More {0} liters wine needed.", wineNededRounded);
- }
- }
- }
Add Comment
Please, Sign In to add comment