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 scanner = new Scanner(System.in);
- int squareMetersGrapesX = Integer.parseInt(scanner.nextLine());
- double grapesPerSquareMeterY = Double.parseDouble(scanner.nextLine());
- int neededLitresWineZ = Integer.parseInt(scanner.nextLine());
- int workers = Integer.parseInt(scanner.nextLine());
- double harvestPerWine = squareMetersGrapesX * grapesPerSquareMeterY * 0.40;
- double wine = harvestPerWine / 2.5;
- if (wine >= neededLitresWineZ) {
- double wineLeft = wine - neededLitresWineZ;
- System.out.printf("Good harvest this year! Total wine: %.0f liters.%n", Math.floor(wine));
- System.out.printf("%.0f liters left -> %.0f liters per person.", Math.ceil(wineLeft), Math.ceil(wineLeft / workers));
- } else {
- System.out.printf("It will be a tough winter! More %.0f liters wine needed.", Math.floor(neededLitresWineZ - wine));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement