Advertisement
galinyotsev123

ProgBasicsJavaBook4.1ComplexConditions12Volleyball

Jan 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E12Volleyball {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String year = scanner.nextLine();
  8. int holidaysP = Integer.parseInt(scanner.nextLine());
  9. int weekendsHomeH = Integer.parseInt(scanner.nextLine());
  10.  
  11. double playSofia = (48 - weekendsHomeH) * 3/4.0 + (holidaysP * 2/3.0);
  12. double playHome = weekendsHomeH;
  13. double playTotal = 0;
  14.  
  15.  
  16. if (year.equalsIgnoreCase("normal")){
  17. playTotal = Math.floor(playSofia + playHome);
  18. }
  19. else if (year.equalsIgnoreCase("leap")){
  20. playTotal = Math.floor((playSofia + playHome) * 1.15); //+ 15%
  21.  
  22. }
  23. System.out.printf("%.0f", playTotal);
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement