Advertisement
NikolayPresolski

Задача 2.5

Dec 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement