I'm making a wheel of fortune game and i want to include a feature where the user enters in how many players there are and a constructor in a for loop makes that many players. I just don't know how I'd make the objects when they say how many players they want
Player constructor
public Player(String n) {
money = 0.0;
name = n;
}
Problem
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int playerAmount = 0;
do {
if(playerAmount > 5) System.out.println("Thats too many.");
System.out.print("How many players(max 5): ");
playerAmount = kb.nextInt();
} while(playerAmount > 5 || playerAmount == 1);
for(int i = 1; i <= playerAmount; i++) {
System.out.print("Player " + i + " name: ");
String name = kb.next(); // name for the construction of player
Player player1 = new Player(name); // where i want to construct differeing number of different objects
}
}