Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by Niki on 10/29/2017.
- */
- public class HarvestTest {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int vineyard = Integer.parseInt(scanner.nextLine());
- double quantity = Double.parseDouble(scanner.nextLine());
- int liters = Integer.parseInt(scanner.nextLine());
- int workers = Integer.parseInt(scanner.nextLine());
- double wholeGrape = vineyard * quantity;
- double wine = wholeGrape / 2.5 * (40 * 0.01);
- double sum = 0;
- double total = 0;
- if (wine >= liters) {
- sum = Math.ceil(wine - liters);
- total= Math.ceil(sum/ workers);
- System.out.printf("Good harvest this year! Total wine: %.0f liters.%n%.0f liters left -> %.0f liters per person.",Math.floor(wine),sum,total);
- }else if(wine < liters) {
- sum = Math.floor(liters - wine);
- System.out.printf("It will be a tough winter! More %.0f liters wine needed.",sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement