Browse Source

Added rightPrefix Method to Administration Class

remotes/origin/fdai7780
Tobias Herbert 11 months ago
parent
commit
1334a57469
  1. 58
      src/main/java/org/example/Administration.java

58
src/main/java/org/example/Administration.java

@ -223,6 +223,64 @@ public class Administration {
}
return true;
}
public boolean rightPrefix(String userId, int i)
{
switch (i){
case 1:
if(userId.startsWith("S"))
{
return true;
}
else if(userId.startsWith("s"))
{
System.out.println("The ID needs to start with a capital S!");
return false;
}
else if(!userId.startsWith("S"))
{
System.out.println("The ID needs to start with a capital S!");
return false;
}
break;
case 2:
if(userId.startsWith("A"))
{
return true;
}
else if(userId.startsWith("a"))
{
System.out.println("The ID needs to start with a capital A!");
return false;
}
else if(!userId.startsWith("A"))
{
System.out.println("The ID needs to start with a capital A!");
return false;
}
break;
case 3:
if(userId.startsWith("P"))
{
return true;
}
else if(userId.startsWith("p"))
{
System.out.println("The ID needs to start with a capital P!");
return false;
}
else if(!userId.startsWith("P"))
{
System.out.println("The ID needs to start with a capital P!");
return false;
}
break;
default:
System.out.println("Error");
break;
}
return false;
}
}

Loading…
Cancel
Save