Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package homework2222;
- import java.util.Scanner;
- public class rekolta {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int Metraloze = scan.nextInt();
- double grapePerMetre = scan.nextDouble();
- int neededWine = scan.nextInt();
- int workers=scan.nextInt();
- double grapeKilos = Metraloze * grapePerMetre / 0.4;
- double wineLiter = grapeKilos / 2.5;
- if(wineLiter > neededWine) {
- double vinoLeft = wineLiter - neededWine;
- System.out.printf("Good harvest this year! Total wine: %.0f litters.%n", Math.floor(vinoLeft));
- System.out.printf("%.0f litters left -> %.0f litters per person" , Math.ceil(vinoLeft), Math.ceil(vinoLeft/workers));
- }else {
- System.out.printf("It will be a tough winter! More %.0f litters wine needed.", Math.floor(neededWine - wineLiter));
- }
- }
- }
Add Comment
Please, Sign In to add comment