Petra_Abrasheva_185

Годишна работа: 3.2-фирма

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