Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P12_Voleyball {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String year = scanner.nextLine();
- int holidays = Integer.parseInt(scanner.nextLine());
- int homeTownWeekends = Integer.parseInt(scanner.nextLine());
- double restWeekends = 3.0 / 4;
- int allWeekends = 48;
- double sofiaWeekends = allWeekends - homeTownWeekends;
- double sofiaPlays = sofiaWeekends * restWeekends;
- double holidaysPlays = holidays * (2.0/3);
- double allPlays = homeTownWeekends + sofiaPlays + holidaysPlays;
- if (year.equals("leap")){
- double allPlay = allPlays + (allPlays * 0.15);
- double result = Math.floor(allPlay);
- System.out.printf("%.0f", result);
- } else if (year.equals("normal")){
- double result = Math.floor(allPlays);
- System.out.printf("%.0f", result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement