Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.       Scanner sc=new Scanner(System.in);
  6.      
  7.       int x= Integer.parseInt(sc.nextLine());
  8.       double y= Double.parseDouble(sc.nextLine());
  9.       int z= Integer.parseInt(sc.nextLine());
  10.       int workers = Integer.parseInt(sc.nextLine());
  11.      
  12.       double grape= x*y;
  13.       double grapeForWine= (grape/2.5) * 0.4;
  14.            if (grapeForWine >=z){
  15.           System.out.printf("Good harvest this year!Total wine: %.0f liters.%n", Math.floor(grapeForWine));
  16.           double left= grapeForWine- z;
  17.           double winePerWorker= left/workers;
  18.           System.out.printf("%.0f liters left-> %.0f liters per person.", Math.ceil(left), Math.ceil(winePerWorker));
  19.           }else{
  20.               double neededWine= z-grapeForWine;
  21.           System.out.printf("It will be a tough winter! More %.0f liters wine needed.", Math.floor(neededWine));
  22.       }
  23.    
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement