Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Volleyball_09 {
- public static void main(String[] args) {
- Scanner myScan = new Scanner(System.in);
- int weekends = 48;
- String yearType = myScan.nextLine();
- int holidaysCount = Integer.parseInt(myScan.nextLine());
- int weekendsHome = Integer.parseInt(myScan.nextLine());
- double weekendsInSofia = weekends - weekendsHome;
- if (yearType.equals("leap")) {
- // 3/4 games from the total weekends in Sofia
- double playedGamesInSofia = weekendsInSofia * 0.75;
- double playedGamesHome = weekendsHome;
- double holidayGames = holidaysCount / 3.0 * 2;
- double totalPlayedGames = playedGamesHome + playedGamesInSofia + holidayGames;
- // 15% more played games in leap year
- totalPlayedGames = totalPlayedGames * 1.15;
- System.out.printf("%.0f",Math.floor(totalPlayedGames));
- } else if (yearType.equals("normal")) {
- double playedGamesInSofia = weekendsInSofia * 0.75;
- double playedGamesHome = weekendsHome;
- double holidayGames = holidaysCount / 3.0 * 2;
- double totalPlayedGames = playedGamesHome + playedGamesInSofia + holidayGames;
- System.out.printf("%.0f",Math.floor(totalPlayedGames));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement