Advertisement
Guest User

Untitled

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