Advertisement
Angel_Kalinkov

ProgrammingBasicsExam-28August2016-Firm_AngelKalinkov

Oct 13th, 2017
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Firm {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int neededHours = Integer.parseInt(scanner.nextLine());
  8.         int days = Integer.parseInt(scanner.nextLine());
  9.         int workers = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double workDays = days * 0.9;
  12.         double workHours = workDays * workers * (8+2);
  13.         double hoursDif = Math.abs(neededHours - workHours);
  14.  
  15.         if (workHours >= neededHours) {
  16.             System.out.printf("Yes!%.0f hours left.%n", Math.floor(hoursDif));
  17.         } else {
  18.             System.out.printf("Not enough time!%.0f hours needed.%n", Math.floor(hoursDif));
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement