|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Please help...Playoffs of 8 teams?
Hi,
I'm writing a program which takes the ranks and names (user input) of 8 teams and decides a winner through 3 rounds of playoffs. Now the winner of each round is decided by their rank (higher rank wins). I'm having trouble putting this into the program. So far I have(output): Input team 1's name: [print this] Team 1 [enter this] Input team 1's ranking: [print this] 90.4 [enter this] etc. But I need to display this after what I have: Round 1 Teams: ---------------- Team 1 90.4 Team 2 81.6 Team 3 88.9 Team 4 90.2 Team 5 83.9 Team 6 79.9 Team 7 80.7 Team 8 88.8 Round 2 Teams: ---------------- Team 1 90.4 Team 4 90.2 Team 5 83.9 Team 8 88.8 Round 3 Teams: ---------------- Team 1 90.4 Team 8 88.8 Winner: ---------------- Team 1 90.4 Now I can get the first round output with this code: System.out.println("\n\nRound 1 Teams:\n--------------"); for (Team team : teams) { System.out.println(">>> " + team); } } } class Team { private String name; private double rank; public Team(String name, double rank) { this.name = name; this.rank = rank; } public String toString() { return String.format("%s %.1f", this.name, this.rank); } } But the other rounds...? I don' t know. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Please help...Playoffs of 8 teams? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|