Advertisement
galinyotsev123

ProgBasicsJavaBook3.2SimpleConditions05Firm

Jan 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. double projectHours = Double.parseDouble(scanner.nextLine());
  9. double availableDays = Double.parseDouble(scanner.nextLine());
  10. double workers = Double.parseDouble(scanner.nextLine());
  11.  
  12. double workDays = availableDays * 0.90;
  13. double overtimeHours = workDays * workers * 2;
  14. double workHours = workDays * workers * 8;
  15. double totalHours = Math.floor(overtimeHours + workHours);
  16.  
  17. if (totalHours >= projectHours) {
  18. System.out.printf("Yes!%.0f hours left.", totalHours - projectHours);
  19. } else {
  20. System.out.printf("Not enough time!%.0f hours needed.", projectHours - totalHours);
  21.  
  22. }
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement