Advertisement
marking2112

VoleyBall

Jun 23rd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P12_Voleyball {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String year = scanner.nextLine();
  8.         int holidays = Integer.parseInt(scanner.nextLine());
  9.         int homeTownWeekends = Integer.parseInt(scanner.nextLine());
  10.         double restWeekends = 3.0 / 4;
  11.         int allWeekends = 48;
  12.  
  13.         double sofiaWeekends = allWeekends - homeTownWeekends;
  14.         double sofiaPlays = sofiaWeekends * restWeekends;
  15.         double holidaysPlays = holidays * (2.0/3);
  16.  
  17.         double allPlays = homeTownWeekends + sofiaPlays + holidaysPlays;
  18.  
  19.         if (year.equals("leap")){
  20.             double allPlay = allPlays + (allPlays * 0.15);
  21.             double result = Math.floor(allPlay);
  22.             System.out.printf("%.0f", result);
  23.         } else if (year.equals("normal")){
  24.             double result = Math.floor(allPlays);
  25.             System.out.printf("%.0f", result);
  26.         }
  27.  
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement