desislava777

Harvest

Aug 4th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 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 ConsoleApplication21
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double x = double.Parse(Console.ReadLine());
  14. double y = double.Parse(Console.ReadLine());
  15. double z = double.Parse(Console.ReadLine());
  16. int persons = int.Parse(Console.ReadLine());
  17. double grapes =x * y;
  18. double wine;
  19. wine =(40 * grapes / 100) / 2.5;
  20. if (wine >= z)
  21. {
  22. double remains = wine - z;
  23. double wineForPersons = remains / persons;
  24. Console.WriteLine("Good harvest this year! Total wine: {0} liters.",Math.Floor(wine));
  25. Console.WriteLine("{0} liters left -> {1} liters per person.",Math.Ceiling(remains),
  26. Math.Ceiling(wineForPersons));
  27. }
  28. else if (wine < z)
  29. {
  30.  
  31. double needOf = z - wine;
  32. Console.WriteLine("It will be a tough winter! More {0} liters wine needed.",Math.Floor(needOf));
  33.  
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment