deyanivanov966

09. Volleyball

Aug 29th, 2020 (edited)
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Volleyball {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String year = scanner.nextLine();
  8.         double holidays = Double.parseDouble(scanner.nextLine());
  9.         double weekends = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double weekendSofia = (48 - weekends) * (3.0 / 4.0);
  12.         double holidaysPlay = holidays * (2.0 / 3.0);
  13.         double playedDays = weekendSofia + holidaysPlay + weekends;
  14.  
  15.         if ("leap".equalsIgnoreCase(year)) {
  16.             holidaysPlay = playedDays + playedDays * 0.15;
  17.             System.out.printf("%f",Math.floor(holidaysPlay));
  18.         } else if ("normal".equalsIgnoreCase(year)) {
  19.             System.out.printf("%f", Math.floor(playedDays));
  20.         }
  21.     }
  22. }
Add Comment
Please, Sign In to add comment