Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 1 : The user will be able to give a string as an argument to the method and the method will return the number
Task : The user will be able to give a string as an argument to the method and the method will return the number of characters in the string including white spaces Complete the method public static int returnTheLengthOfTheString to complete this task. See the method comments for more detail.
Task : The user will be able to give a string and an index position in the string as arguments to the method. The method will return the character located at that index position in the string including white spaces Complete the method public static char returnTheCharacterAtTheGivenIndex to complete this task. See the method comments for more detail.
Task : The user will be able to give a string and an index position in the string as arguments to the method. The method will return the substring starting at that index position in the string including white spaces to the end of the string. Complete the method public static String returnTheSubStringStartingAtTheGivenIndex to complete this task. See the method comments for more detail.
Task : The user will be able to give a string and two index positions in the string as arguments to the method. The method will return the substring starting at the first index position in the string and ending at the second index position in the stringincluding white spaces Complete the method public static String returnTheSubStringBetweenStartAndEndIndex to complete this task. See the method comments for more detail.
Task : The user will be able to give a string as an argument to the method. If there are any occurrences of the substring in the supplied argument, then the method will return a new string with all occurrences of changed to Complete the method public static String changeAllOccurancesOfTo to complete this task. See the method comments for more detail.
Task : The user will be able to give a string as an argument to the method. The method will check if the given string matches the valid password regular expression. The method will return true if the pattern matches, false if any password rule is not met. Complete the method public static boolean checkIfPasswdIsValid to complete this task. See the method comments for more detail.
Task : The user will be able to give a string as an argument to the method. The method will match the regular expression pattern for a valid email address and count the number of those valid email addresses that are found in the file. The method will return the number of valid emails found in the string. Complete the method public static int countNumberOfValidEmailAddresses to complete this task. See the method comments for more dpackage astringsandregexJtorres;
public class StringRegExAssignment
return the length of a given string
return is the string is null
public static int returnTheLengthOfTheStringString word
int numberOfCharacters
return ;
return the character at the given index in word
public static char returnTheCharacterAtTheGivenIndexString word, int index
return ;
return the substring starting from the given index
public static String returnTheSubStringStartingAtTheGivenIndexString word, int index
return ;
return the substring from the start index to the end index
public static String returnTheSubStringBetweenStartAndEndIndexString word, int startIndex, int endIndex
return ;
if there are occurrences of in the paragraph, replace with
public static String changeAllOccurancesOfToString paragraph
return ;
A valid password has the following pattern
starts with an uppercase letter
ends with a lowercase letter
the second to last character is either a number or
the length is at least but no more than
public static boolean checkIfPasswdIsValidString passwd
return false;
For the purposes of this assignment, assume a valid email address has the following pattern
four parts:
Recipient name made up of uppercase and lowercase letters, digits to Length at least but no more than
@ symbol
Domain name made up of uppercase and lowercase letters, digits to Length at least but no more than
Toplevel domain either com or net or edu
public static int countNumberOfValidEmailAddressesString fileDump
return next is hte code the main method will be reading from public class StringRegExDriver
public static void mainString args
System.out.printlnStringRegExAssignmentreturnTheLengthOfTheString;
System.out.printlnStringRegExAssignmentreturnTheLengthOfTheString
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started