dakata450

Untitled

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