Advertisement
16112

2.4 Реколта

Dec 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package kursova_rabota;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class dve_chetiri {
  6.  
  7.     public static void main(String[] args) {
  8.         // TODO Auto-generated method stub
  9.         Scanner sc = new Scanner(System.in);
  10.         int x = Integer.parseInt(sc.nextLine());
  11.         double y = Double.parseDouble(sc.nextLine());
  12.         int z = Integer.parseInt(sc.nextLine());
  13.         int rabotnici = Integer.parseInt(sc.nextLine());
  14.         double ObshtoGrozde = Math.abs(x * y);
  15.         double ObshtoVino = Math.abs((ObshtoGrozde / 2.5) * 0.4);
  16.         if (ObshtoVino < z) {
  17.             double NedostigashtoVino = Math.round(z - ObshtoVino);
  18.             System.out.println("It will be a tough winter! More " + NedostigashtoVino + " liters wine needed");
  19.         } else {
  20.             double OstavashtiLitri = ObshtoVino - z;
  21.             double VinoZaRabotnicite = OstavashtiLitri / rabotnici;
  22.             System.out.println("Good harvest this year! Total wine: " + ObshtoVino + " liters.");
  23.             System.out.format(OstavashtiLitri + " left -> " + Math.floor(VinoZaRabotnicite) + " liters per person");
  24.         }
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement