SHARE
TWEET

Задача 2.5

NikolayPresolski Dec 14th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Java1program;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class dwe_pet {
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.  
  11.         int neededHours = Integer.parseInt(scanner.nextLine());
  12.         int days = Integer.parseInt(scanner.nextLine());
  13.         int workers = Integer.parseInt(scanner.nextLine());
  14.  
  15.         double workDays = (days * 0.9) * 8;
  16.         double workHours = (workers * (2 * days));
  17.         double hours = workHours + workDays;
  18.         double dif = hours - neededHours;
  19.         double hoursDif = Math.floor(hours - neededHours) * (-1);
  20.  
  21.  
  22.         if (hours >= neededHours) {
  23.             System.out.printf("Yes !%.0f hours left.", dif);
  24.         } else {
  25.             System.out.printf("Not enough time!%.0f hours needed.", hoursDif);
  26.         }
  27.  
  28.  
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top