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

Write code for a JOptionPane dialog that will ask whether the user is at least 1

ID: 3935354 • Letter: W

Question

Write code for a JOptionPane dialog that will ask whether the user is at least 18 years of age. Then set the boolean variable adult equal to either true, if the user is at least 18, or false otherwise. Include the declaration of the variable adult. What output is produced by the following code? int code - 2; switch (code) case 1: System.out.println("Hello."); case 3: System.out.printIn("Good-bye."); break; default: System.out.printIn("Till we meet again."); break;) Rewrite the following block using nested if: if (x 0) sign = 1;

Explanation / Answer

2)))))))))))))

output:

till we met again.

as there is no 2 the default case will be executed

3))))))))))))))

if(x<0)

{

sign=-1;

}

else if (x==0)

{

sign=0;

}

else

{

if(x>0)

{

sign=1;

}

}

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