Here's what I'm trying to do:
-add user profiles based on a blueprint(class)
-using a "next empty slot in a array" finder to set a variable to that next empty slot number
-and using that next empty slot number as a user profile number to create a user profile so I can reference that profile from other parts of the program using the slot/user number
public user[] userNum= new user[99];
public void createNewUser(){
int nextUserNum = 99;
for(int i = 0; i < userNum.length; i++){
if (userNum[i] == null){
nextUserNum = i;
break;
}
user <nextUserNum> = new user(nextUserNum); //ERROR AREA
}
}
-this ERROR AREA point, between the "< >", is where I'd like the variable for the user class to be the number generated by the code above it
-this way every time I initiate creatNewUser(); its creates a new user(); class with the nextUserNum assigned as its user number to identify it later
-so when I choose to edit a user profile and ask which user profile I'm editing I can enter in this "user number' and it will only change the "userName" in the user profile I entered
int userToEdit;
System.out.println("What is the User Number for the User you wish to Edit:");
userToEdit = keyboard.nextInt();
String first, middle, last;
System.out.println("First Name:");
first = keyboard.nextLine();
System.out.println("Middle Name:");
middle = keyboard.nextLine();
System.out.println("Last Name:");
last = keyboard.nextLine();
<userToEdit>.changeUserName(first, middle, last); //ERROR AREA
-this ERROR AREA, betweeen the "< >", is where I believe my change needs to be made, I need a way for User Number answer to the question about to be the variable in the changeUserName(); method
-honestly not sure if I can even perform this in this way, but cannot find a specific solution to the task I'm trying to perform in my textbook. pleaseHelp();