Advertisement
psi_mmobile

Untitled

May 12th, 2022
985
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. public class MyClass {
  2.     public static void main(String args[]) {
  3.         java.util.Scanner scanner = new java.util.Scanner(System.in);
  4.         int participations = scanner.nextInt();
  5.         int startingPoints = scanner.nextInt();
  6.         String placing = null;
  7.         int totalPoints = 0;
  8.         int wins = 0;
  9.         for (int i = 1; i <= participations; i++) {
  10.             placing = scanner.next();
  11.             switch(placing) {
  12.                 case "W" : totalPoints += 2000;wins++;break;
  13.                 case "F" : totalPoints += 1200; break;
  14.                 case "SF" : totalPoints += 720; break;
  15.                 default : totalPoints = totalPoints;
  16.             }
  17.         }
  18.         System.out.printf("Final points: %d\n", totalPoints + startingPoints);
  19.         System.out.printf("Average points: %.0f\n", Math.floor((double)totalPoints/participations));
  20.         System.out.printf("%.2f%%", 100.00 * wins/participations);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement