Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EP03Volleyball {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String yearType = scanner.nextLine();
- int holidays = Integer.parseInt(scanner.nextLine());
- int weekends = Integer.parseInt(scanner.nextLine());
- int totalWeekends = 48;
- double volleyGames = 0;
- switch (yearType) {
- case "leap":
- volleyGames = ((totalWeekends - weekends) * 3.0 / 4) + weekends + (holidays * 2.0 / 3);
- double percentage15 = volleyGames * 0.15;
- System.out.printf("%.0f", Math.floor(volleyGames + percentage15));
- break;
- case "normal": {
- volleyGames = ((totalWeekends - weekends) * 3.0 / 4) + weekends + (holidays * 2.0 / 3);
- System.out.printf("%.0f", Math.floor(volleyGames));
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment