Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TennisRanklist {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int tournamentCount = Integer.parseInt(scanner.nextLine());
- int points = Integer.parseInt(scanner.nextLine());
- int tournamentPoints = 0, win = 0;
- for (int i = 0; i < tournamentCount; i++) {
- String currentTournament = scanner.nextLine();
- switch (currentTournament) {
- case "W" -> {
- tournamentPoints += 2000;
- win++;
- }
- case "F" -> tournamentPoints += 1200;
- case "SF" -> tournamentPoints += 720;
- }
- }
- System.out.printf("Final points: %d\n", points + tournamentPoints);
- System.out.printf("Average points: %d\n", (int)(tournamentPoints / tournamentCount));
- System.out.printf("%.2f%%\n", 100.0 * win / tournamentCount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement