Advertisement
veronikaaa86

09. Volleyball

Jun 20th, 2021
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package advancedConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P09Volleyball {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String leapOrNormal = scanner.nextLine();
  10. int countHolidays = Integer.parseInt(scanner.nextLine());
  11. int countWeekendsHome = Integer.parseInt(scanner.nextLine());
  12.  
  13. double saturdayGames = (48 - countWeekendsHome) * 3.0 / 4;
  14. double holidaysGames = countHolidays * 2 / 3.0;
  15.  
  16. double allGames = saturdayGames + countWeekendsHome + holidaysGames;
  17.  
  18. if (leapOrNormal.equals("leap")) {
  19. allGames = allGames * 1.15;
  20. }
  21.  
  22. System.out.printf("%.0f", Math.floor(allGames));
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement