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);
- String team = scanner.nextLine(), result;
- int matchCount = Integer.parseInt(scanner.nextLine()),
- won = 0, drawn = 0, lost = 0;
- for (int i = 0; i < matchCount; i++) {
- result = scanner.nextLine();
- if (result.equals("W")) {
- won++;
- } else if (result.equals("D")) {
- drawn++;
- } else {
- lost++;
- }
- }
- if (matchCount == 0) {
- System.out.println(team + " hasn't played any games during this season.");
- } else {
- System.out.printf(
- """
- %s has won %d points during this season.
- Total stats:
- ## W: %d
- ## D: %d
- ## L: %d
- Win rate: %.2f%%
- """
- , team, won * 3 + drawn, won, drawn, lost, 100.0 * won / matchCount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement