tchenkov

L04u12_Volleyball

Jan 23rd, 2017
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package Uprajneniq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by todor on 23.01.2017 г..
  7.  */
  8. public class u12_Volleyball {
  9.     public static void main(String[] args) {
  10.  
  11.         Scanner scan = new Scanner(System.in);
  12.  
  13.         String yearType = scan.nextLine().toLowerCase();
  14.         int holidays = Integer.parseInt(scan.nextLine());
  15.         int weekendsAtHome = Integer.parseInt(scan.nextLine());
  16.  
  17.         int weekends = 48;
  18.  
  19.         double activeInSofia = (weekends - weekendsAtHome) * 0.75;
  20.         double activeAtHolidays = (holidays*2.0) / 3;
  21.         double totalPlayedGames = activeInSofia + weekendsAtHome + activeAtHolidays;
  22.  
  23.         if (yearType.equals("normal")) {
  24.             System.out.println((int)totalPlayedGames);
  25.         }
  26.         else if (yearType.equals("leap")) {
  27.             totalPlayedGames *= 1.15;
  28.             System.out.println((int)totalPlayedGames);
  29.         }
  30.  
  31.     }
  32. }
Add Comment
Please, Sign In to add comment