MilaDimitrovaa

Rekolta

Nov 3rd, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package homework2222;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class rekolta {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan =  new Scanner(System.in);
  9.         int Metraloze = scan.nextInt();
  10.         double grapePerMetre = scan.nextDouble();
  11.         int neededWine = scan.nextInt();
  12.         int workers=scan.nextInt();
  13.         double grapeKilos = Metraloze * grapePerMetre / 0.4;
  14.         double wineLiter = grapeKilos / 2.5;
  15.        
  16.         if(wineLiter > neededWine) {
  17.        
  18.            double vinoLeft = wineLiter - neededWine;
  19.            System.out.printf("Good harvest this year! Total wine: %.0f litters.%n", Math.floor(vinoLeft));
  20.            System.out.printf("%.0f litters left -> %.0f litters per person" , Math.ceil(vinoLeft), Math.ceil(vinoLeft/workers));
  21.         }else {
  22.              System.out.printf("It will be a tough winter! More %.0f litters wine needed.", Math.floor(neededWine - wineLiter));
  23.              
  24.            
  25.            
  26.        }
  27.            
  28.            
  29.         }
  30.     }
Add Comment
Please, Sign In to add comment