diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index c9e5d90..a27384c 100644 --- a/src/main/java/org/example/Administration.java +++ b/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; + } }