Helena12

Volleyball

Oct 29th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EP03Volleyball {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String yearType = scanner.nextLine();
  8.         int holidays = Integer.parseInt(scanner.nextLine());
  9.         int weekends = Integer.parseInt(scanner.nextLine());
  10.         int totalWeekends = 48;
  11.         double volleyGames = 0;
  12.  
  13.         switch (yearType) {
  14.             case "leap":
  15.                 volleyGames = ((totalWeekends - weekends) * 3.0 / 4) + weekends + (holidays * 2.0 / 3);
  16.                 double percentage15 = volleyGames * 0.15;
  17.                 System.out.printf("%.0f", Math.floor(volleyGames + percentage15));
  18.                 break;
  19.             case "normal": {
  20.                 volleyGames = ((totalWeekends - weekends) * 3.0 / 4) + weekends + (holidays * 2.0 / 3);
  21.                 System.out.printf("%.0f", Math.floor(volleyGames));
  22.                 break;
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment