Question: usernameChecker ( ) Method Write a method called usernameChecker ( ) that accepts one parameter String called username. The method should check to make sure

usernameChecker() Method
Write a method called usernameChecker() that accepts one parameter String called username. The method should check to make sure that username is at least 8 characters in length and contains one of 4 special symbols (!, $,%, &).
The method should return true if the username requirements are met and return false if requirements are not met.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class CodingQuestion {
// Write your static method here
/***** DO NOT CHANGE THE CODE BELOW THIS LINE *****/
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String username = in.nextLine();
boolean meetsRequirement = usernameChecker(username);
if (meetsRequirement){
System.out.println(username +" meets the requirements.");
} else {
System.out.println(username +" does not meet the requirements.");
}
}// end of main()
}
Expected STDOUT
ollie! does not meet the requirements.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!