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

Here is my work: http://pastebin.com/embed_js.php?i=WtkvfxVY //** So what im try

ID: 3540330 • Letter: H

Question

Here is my work: http://pastebin.com/embed_js.php?i=WtkvfxVY


//** So what im trying have the user put in one of the domains last. When I start using domain 2 on the second part I get this as my output;

"Email Address OK
Invalid Email Address
Email Address OK
Invalid Email Address
Email Address OK
Invalid Email Address
Email Address OK "



//**So how can I fix this for the second and the rest of the domains. ANOTHER thing im also trying to figure out is have the @ before the domain. would I use .beginsWith?????? Thank you


char ampersand = '@';
                String domain1 = ".com";
                String domain2 = ".edu";
                String domain3 = ".org";
                String domain4 = ".mil";
                String domain5 = ".gov";
                String domain6 = ".net";
               
                Boolean ending = input.endsWith(domain1);
                if (ending == false ) {
                    System.out.println( "Invalid Email Address" );
                    }
                    else {
                    System.out.println( "Email Address OK " );
                   
                    }
               
                Boolean endin = input.endsWith(domain2);
                if (endin == false ) {
                    System.out.println( "Invalid Email Address" );
                    }
                    else {
                    System.out.println( "Email Address OK " );
                    break;
                    }

Explanation / Answer

char ampersand = '@';

String domain1 = ".com";

String domain2 = ".edu";

String domain3 = ".org";

String domain4 = ".mil";

String domain5 = ".gov";

String domain6 = ".net";

Boolean ending = input.endsWith(domain1);

if (ending == true ) {

System.out.println( "Email Address OK" );

break;

}

Boolean endin = input.endsWith(domain2);

if (endin == true ) {

System.out.println( "Email Address OK" );

break;

}

else {

System.out.println( "Invalid Email Address " );

break;

}

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