Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.Softuni2;
- import java.util.Scanner;
- public class TEST {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int squareGrape = Integer.parseInt(scanner.nextLine());
- double oneSquareGrape = Double.parseDouble(scanner.nextLine());
- int litersNeed = Integer.parseInt(scanner.nextLine());
- int workers = Integer.parseInt(scanner.nextLine());
- double allGrape = squareGrape * oneSquareGrape;
- double needGrape = allGrape * 0.40;
- double litersWine = needGrape / 2.5;
- if (litersWine >= litersNeed) {
- System.out.printf("Good harvest this year! Total wine: %d liters.\n", (int)Math.floor(litersWine));
- double leftWine = litersWine - litersNeed;
- double oneWorkerWine = leftWine / workers;
- System.out.printf("%d liters left -> %d liters per person.", (int)Math.ceil(leftWine), (int)Math.ceil(oneWorkerWine));
- } else {
- double needWine = litersNeed - litersWine;
- System.out.printf("It will be a tough winter! More %d liters wine needed.",(int)Math.floor(needWine));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment