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