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