Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int startHours = Integer.parseInt(scanner.nextLine()),
- checkHours = Integer.parseInt(scanner.nextLine()),
- checkMinutes = Integer.parseInt(scanner.nextLine());
- String dayOfWeek = scanner.nextLine();
- double bonusPoints = 0;
- if (checkHours < startHours && checkHours <= (startHours - 1)) {
- bonusPoints = 1.5;
- } else if (checkHours == startHours && checkMinutes <= 30) {
- bonusPoints = 1;
- } else if ((checkHours == startHours && checkMinutes > 30) || checkHours <= (startHours + 4)) {
- bonusPoints = 0.5;
- }
- if (dayOfWeek.equals("Monday") || dayOfWeek.equals("Wednesday") || dayOfWeek.equals("Friday")) {
- bonusPoints += 0.6;
- } else if (dayOfWeek.equals("Tuesday") || dayOfWeek.equals("Thursday") || dayOfWeek.equals("Saturday")) {
- bonusPoints += 0.8;
- } else {
- bonusPoints += 2;
- }
- System.out.printf("%.2f\n", bonusPoints);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement