Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

<script src=\"http://pastebin.com/embed_js.php?i=NmYVDQBP\"></script> Have my wo

ID: 3540255 • Letter: #

Question

<script src="http://pastebin.com/embed_js.php?i=NmYVDQBP"></script>


Have my work listen above. Im having trouble with the special characters. Everytime I put in something like helloHoware2you$

it says "Nooo". The loop goes back to the previous statment. I dont know how to keep it from doing that. Also another question after I complete this portion. I have to move on to list domains. Would I also list them as arrays Like I have for the numbers and Special Character?? Please and thank you :D

    

char [] numbers= {'0','1','2','3', '4','5','6','7','8','9'};
            char[] inputArray1 = input.toCharArray();

            for (int i = 0; i < inputArray1.length; i++)
            {
                for (int j = 0; j < numbers.length; j++)
                {
                    if (inputArray1[i]== numbers[j])
                {
                break;   
                }
                else
                {
                    if(i == inputArray1.length-1 && j== numbers.length-1)
                {

                 System.out.println("Nooo");
                }
                }
                }
            }
            {
                 input = keyboard.nextLine();
            }

char [] SpecialCharacter = {']','[','?','/','<','~','#','.','!','$','%','^','&','*','(',')','+','=','}','|','>','{' };
            char[] inputArray = input.toCharArray();

            for (int k = 0; k < inputArray.length; k++)
            {
                for (int l = 0; l < SpecialCharacter.length; l++)
                {
                    if (inputArray[k]== SpecialCharacter[l])
                {
                break;   
                }
                 else
                {
                    if(k == inputArray.length-1 && l == SpecialCharacter.length-1)
                {
                      System.out.println("nope!!");
                }
                }
                }
            }
            {
                 input = keyboard.nextLine();
            }



Explanation / Answer

please rate - thanks


it's your breaks


char [] numbers= {'0','1','2','3','4','5','6','7','8','9'};
                         char[] inputArray1 = input.toCharArray();

                         for (int i = 0; i < inputArray1.length; i++)
                         {
                                 for (int j = 0; j < numbers.length; j++)
                                 {if (inputArray1[i]== numbers[j])
                                             {
                                               i=inputArray1.length;
                                                            j=numbers.length;   
                                             }
                                         else
                                              {
                                               if(i == inputArray1.length-1 && j== numbers.length-1)
                                                     {

                                                        System.out.println("Nooo");
                                                                        input = keyboard.nextLine();
                                                     }
                                               }
                                 }
                         }
                                                                   
char [] SpecialCharacter = {']','[','?','/','<','~','#','.','!','$','%','^','&','*','(',')','+','=','}','|','>','{' };
                         char[] inputArray = input.toCharArray();

                         for (int k = 0; k < inputArray.length; k++)
                         {
                                 for (int l = 0; l < SpecialCharacter.length; l++)
                                 {
                                         if (inputArray[k]== SpecialCharacter[l])
                                 {
                                            k=inputArray.length;
                                                            l=SpecialCharacter.length;    
                                 }
                                  else
                                 {
                                          if(k == inputArray.length-1 && l == SpecialCharacter.length-1)
                                 {
                                      System.out.println("nope!!");
                                                input = keyboard.nextLine();
                                 }
                                 }
                                 }
                         }


---------------------------------------------------------------------------------

I would do your program like this


va.util.Scanner;
public class main {

        public static void main(String[] args) {
                Scanner keyboard = new Scanner(System.in);
                boolean error;
                    int i;
                System.out.println("Must be between 8 and 20 characters.");
                System.out.println("Must contain at least one uppercase and lowercase letter.");
                System.out.println("Must contain at least one digit. ");
                System.out.println("Must contain a special character ] [ ? / < ~ # ! $ % ^ & * ( ) + = } | : ; , > { ");
                System.out.println("Must contain @ before the domain");
                System.out.println("The only acceptable domains are .com .edu .org .mil .gov .net");
                System.out.println(" ____Please enter your username to access the page. Follow the rules above.____ ");
               
                    do
                    {error=false;
                   
                String input = keyboard.nextLine();
                if ((input.length() < 8) || (input.length() > 20))
                {
                System.out.println("Error! Your input is not valid.");
                System.out.println("Please try again.");
                error=true;
                }
                    
                        for ( i = 0; i < input.length(); i++)
                   
                        if(Character.isUpperCase(input.charAt(i)))
                        {
                                i = input.length()+1;                        
                        }
                        if(i == input.length())
                                {
                                        System.out.println("Error: Try again");
                                        error=true;
                                }
                                            
                        for ( i = 0; i < input.length(); i++)
                    {
                        if(Character.isLowerCase(input.charAt(i)))
                        {
                                i = input.length()+1;                        
                        }
                                              
                        }
                       if(i == input.length())
                                {
                                        System.out.println("Try again");
                                        error=true;
                                }

                         char [] numbers= {'0','1','2','3','4','5','6','7','8','9'};
                         char[] inputArray1 = input.toCharArray();

                         for (i = 0; i < inputArray1.length; i++)
                         {
                                 for (int j = 0; j < numbers.length; j++)
                                 {if (inputArray1[i]== numbers[j])
                                             {
                                               i=inputArray1.length;
                                                            j=numbers.length;   
                                             }
                                         else
                                              {
                                               if(i == inputArray1.length-1 && j== numbers.length-1)
                                                     {

                                                        System.out.println("Nooo");
                                                                        error=true;
                                                     }
                                               }
                                 }
                         }
                                                                   
char [] SpecialCharacter = {']','[','?','/','<','~','#','.','!','$','%','^','&','*','(',')','+','=','}','|','>','{' };
                         char[] inputArray = input.toCharArray();

                         for (int k = 0; k < inputArray.length; k++)
                         {
                                 for (int l = 0; l < SpecialCharacter.length; l++)
                                 {
                                         if (inputArray[k]== SpecialCharacter[l])
                                 {
                                            k=inputArray.length;
                                                            l=SpecialCharacter.length;    
                                 }
                                  else
                                 {
                                          if(k == inputArray.length-1 && l == SpecialCharacter.length-1)
                                 {
                                      System.out.println("nope!!");
                                                error=true;
                                                    }
                                 }
                                 }
                         }
                            }while(error);
                                              }
                            }
                        
      
       

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote