So far I have created an Array List which only currently consists of one user. For my assignment, I have been asked to print out properties for that user such as its username and userType. As far as I aware I have created an enhanced for loop that would print out these properties if only they were assigned. My question is how would I go about assigning these properties to my user? I have created a UserGroup class in which the array list resides in and a User class in which some details about the User is specified however I am not quite sure if the User class is correct for what I am trying to achieve. Here is the code for both classes:
UserGroup:
 package main;
import java.util.ArrayList;
public class UserGroup {
    ArrayList<User> userGroup = new ArrayList<>();
    User userOne;
    public void addSampleData(String username, String userType, String name) {
    userGroup.add(new User("LeeB", "Staff", "Lee"));
}
    public User getUser(int index)  {
    return userGroup.get(0);
}
    public void printusername(){
       for (User x : userGroup)
           System.out.println(x);
    }
}
User:
 package main;
class User {
  String username;
  String userType;
  String name;
    User(String username, String userType, String name) {
    this.username = username;
    this.userType = userType;
    this.name = name;
    }
  public String getUsername() {
      return username;
  }
  public String getUserType() {
      return userType;
  }
   public String getName() {
      return name;
  }
  public String setUserType(String admin) {
      return userType = admin;
  }
}
Main method:
package main;
public class Main {
 public static void main(String[] args) {
    for (int counter=2; counter<=40; counter+=2) {
       System.out.println(counter);
    }
    System.out.println("For loop complete.");
    int counter = 1;
    int increment = 2;
    int loopexeccounter = 0;
    while (counter <= 500) {
        loopexeccounter = loopexeccounter + 1;
        System.out.println(counter);
    counter = counter + increment++;
    }
System.out.print("This loop iteratted "+loopexeccounter+" times.");
}
    public Main() {
     UserGroup userGroupObject = new UserGroup();
 System.out.println(userGroupObject.getUser(0)); 
 }
}
Ignore everything above the latest method, it's just some examples of loops that they wanted us to print out.
Updated version, no errors but user(0) isn't being printed out.
 
     
    