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