Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- int x= Integer.parseInt(sc.nextLine());
- double y= Double.parseDouble(sc.nextLine());
- int z= Integer.parseInt(sc.nextLine());
- int workers = Integer.parseInt(sc.nextLine());
- double grape= x*y;
- double grapeForWine= (grape/2.5) * 0.4;
- if (grapeForWine >=z){
- System.out.printf("Good harvest this year!Total wine: %.0f liters.%n", Math.floor(grapeForWine));
- double left= grapeForWine- z;
- double winePerWorker= left/workers;
- System.out.printf("%.0f liters left-> %.0f liters per person.", Math.ceil(left), Math.ceil(winePerWorker));
- }else{
- double neededWine= z-grapeForWine;
- System.out.printf("It will be a tough winter! More %.0f liters wine needed.", Math.floor(neededWine));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement