Advertisement
Spocoman

Cat Training Attendance

Sep 2nd, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int startHours = Integer.parseInt(scanner.nextLine()),
  7.                 checkHours = Integer.parseInt(scanner.nextLine()),
  8.                 checkMinutes = Integer.parseInt(scanner.nextLine());
  9.         String dayOfWeek = scanner.nextLine();
  10.         double bonusPoints = 0;
  11.  
  12.         if (checkHours < startHours && checkHours <= (startHours - 1)) {
  13.             bonusPoints = 1.5;
  14.         } else if (checkHours == startHours && checkMinutes <= 30) {
  15.             bonusPoints = 1;
  16.         } else if ((checkHours == startHours && checkMinutes > 30) || checkHours <= (startHours + 4)) {
  17.             bonusPoints = 0.5;
  18.         }
  19.  
  20.         if (dayOfWeek.equals("Monday") || dayOfWeek.equals("Wednesday") || dayOfWeek.equals("Friday")) {
  21.             bonusPoints += 0.6;
  22.         } else if (dayOfWeek.equals("Tuesday") || dayOfWeek.equals("Thursday") || dayOfWeek.equals("Saturday")) {
  23.             bonusPoints += 0.8;
  24.         } else {
  25.             bonusPoints += 2;
  26.         }
  27.  
  28.         System.out.printf("%.2f\n", bonusPoints);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement