I am trying to do a primary key so that each member can't hava the same ID and if th same ID is entered an error is give. Can someone please help me cause I can't do it at all.Thank you.
static void addMember(ArrayList<GymUser> UserListIn)
{
String tempUserrID;
String tempID;
String tempName;
String tempSurname;
int tempAge;
String tempAddress;
int tempPhone;
String tempDuration;
Scanner keyboard = new Scanner(System.in);
keyboard.useDelimiter("\n");
System.out.println("Please enter the member's Personal Details");
System.out.println("-------------------- ");
System.out.println("Enter the mebership number");
tempUserrID = keyboard.next();
System.out.print("Enter the ID no.: ");
tempID = keyboard.next();
System.out.print("Enter Name: ");
tempName = keyboard.next();
System.out.print("Enter Surname:");
tempSurname = keyboard.next();
System.out.print("Enter Address:");
tempAddress = keyboard.next();
System.out.print("Enter Age:");
tempAge = keyboard.nextInt();
System.out.print("Enter Phone:");
tempPhone = keyboard.nextInt();
System.out.print("MemberShip Duration:");
tempDuration = keyboard.next();
UserListIn.add(new GymUser(tempUserrID, tempName, tempID, tempSurname, tempAddress, tempPhone, tempAge,tempDuration));
}