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