Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_17_July_2016 - created by borkins on 2017-05-16.
- */
- import java.util.Scanner;
- public class _02_Harvest
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int area = Integer.parseInt(console.nextLine());
- double grapesSqM = Double.parseDouble(console.nextLine());
- double wineNeeded = Double.parseDouble(console.nextLine());
- int workers = Integer.parseInt(console.nextLine());
- double totalGrapes = area * grapesSqM;
- double wine = 0.4 * totalGrapes / 2.5;
- double diffWine = Math.abs(wine - wineNeeded);
- if (wine >= wineNeeded)
- {
- 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(diffWine),
- (int) Math.ceil(diffWine / workers));
- }
- else {
- System.out.printf("It will be a tough winter! " +
- "More %d liters wine needed.%n", (int) diffWine);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment