Advertisement
stoyanoff

Volleyball_09

Jun 24th, 2020
1,650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Volleyball_09 {
  4.     public static void main(String[] args) {
  5.         Scanner myScan = new Scanner(System.in);
  6.  
  7.         int weekends = 48;
  8.  
  9.         String yearType = myScan.nextLine();
  10.         int holidaysCount = Integer.parseInt(myScan.nextLine());
  11.         int weekendsHome = Integer.parseInt(myScan.nextLine());
  12.  
  13.         double weekendsInSofia = weekends - weekendsHome;
  14.  
  15.         if (yearType.equals("leap")) {
  16.             // 3/4 games from the total weekends in Sofia
  17.             double playedGamesInSofia = weekendsInSofia * 0.75;
  18.             double playedGamesHome = weekendsHome;
  19.             double holidayGames = holidaysCount / 3.0 * 2;
  20.             double totalPlayedGames = playedGamesHome + playedGamesInSofia + holidayGames;
  21.             // 15% more played games in leap year
  22.             totalPlayedGames = totalPlayedGames  * 1.15;
  23.  
  24.             System.out.printf("%.0f",Math.floor(totalPlayedGames));
  25.         } else if (yearType.equals("normal")) {
  26.             double playedGamesInSofia = weekendsInSofia * 0.75;
  27.             double playedGamesHome = weekendsHome;
  28.             double holidayGames = holidaysCount / 3.0 * 2;
  29.             double totalPlayedGames = playedGamesHome + playedGamesInSofia + holidayGames;
  30.  
  31.  
  32.             System.out.printf("%.0f",Math.floor(totalPlayedGames));
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement