BubaLazi

p02_FirmProject

Mar 16th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Firm {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.  
  7.         int projectHours = Integer.parseInt(console.nextLine());
  8.         int daysForProject = Integer.parseInt(console.nextLine());
  9.         int workers = Integer.parseInt(console.nextLine());
  10.  
  11.         double workingDays = (daysForProject - (daysForProject*0.10));
  12.  
  13.         double workInProcesHours = workingDays * 8;
  14.         double overWorkingHours = workers * ( 2 * daysForProject);
  15.  
  16.         double totalWorkingHours = Math.floor(overWorkingHours + workInProcesHours);
  17.         double timeIsEnought = 0;
  18.  
  19.         if(totalWorkingHours > projectHours){
  20.             timeIsEnought = Math.floor(projectHours - totalWorkingHours);
  21.             timeIsEnought = Math.abs(timeIsEnought);
  22.             System.out.print("Yes!" + (int)timeIsEnought + " hours left.");
  23.         }else{
  24.             timeIsEnought = Math.floor(totalWorkingHours - projectHours);
  25.             timeIsEnought = Math.abs(timeIsEnought);
  26.             System.out.print("Not enough time!" + (int)timeIsEnought + " hours needed.");
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment