RGAlex

O1. SoftUni Reception / O2. Mid Exam Retake

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