RGAlex

O1. National Court / O4. Mid Exam Retake

Feb 23rd, 2021
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package MidExam.O4;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class O1NationalCourt {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         int firstEmployee = scanner.nextInt();
  10.         int secondEmployee = scanner.nextInt();
  11.         int thirdEmployee = scanner.nextInt();
  12.         int people = scanner.nextInt();
  13.         int time = 0;
  14.         int sum = firstEmployee + secondEmployee + thirdEmployee;
  15.         while (people > 0) {
  16.             people -= sum;
  17.             time += 1;
  18.             if (time % 4 == 0) {
  19.                 time++;
  20.             }
  21.         }
  22.         System.out.printf("Time needed: %dh.", time);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment