dakata450

Untitled

Jun 14th, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package ConditionaStatments;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Harvest {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8. int areaLoze = Integer.parseInt(scanner.nextLine());
  9. double grapeFromM = Double.parseDouble(scanner.nextLine());
  10. int litresLine = Integer.parseInt(scanner.nextLine());
  11. int numberWorkers = Integer.parseInt(scanner.nextLine());
  12. double grapeKol = areaLoze * grapeFromM;
  13. double grozde = grapeKol * 40 /100;
  14. double wine = Math.ceil(grozde / 2.5);
  15. if (wine <= litresLine){
  16. System.out.printf("It will be a tough winter! More %.0f liters wine needed.", Math.floor(litresLine - wine));
  17. }else {
  18. System.out.printf("Good harvest this year! Total wine: %.0f liters. %n", wine);
  19. System.out.printf("%.0f liters left -> %.0f liters per person.", Math.ceil(wine - litresLine), Math.ceil(wine - litresLine) / numberWorkers);
  20. }
  21.  
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment