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

I can not solve this problem. please help me. This is for Java. Print \"userNum1

ID: 3910531 • Letter: I

Question

I can not solve this problem. please help me. This is for Java.

Print "userNum1 is negative." if userNum1 is less than 0. End with newline Convert userNum2 to O if userNum2 is greater than 12. Otherwise, print "userNum2 is less than or equal to 12. End with newline Iass UserNums 2 public static void main (String [] args) int userNum1 int userNum2; 4 userNum1-0; userNum2 7; if (userNun1 0) { userNum2 = 0; 12 13 else if (userNum2-12) userNum2 12 15 16 17 18 System . out . println("userNun1 ?s negative."); System.out.println("userNum2 is less than or equal to 12."); 20 21 tem . nut .nrintIn("userNum2 ?s + userNum2 "

Explanation / Answer


Given below is the fixed code for the question.
Please do rate the answer if it was helpful. Thank you


public class UserNums {

public static void main(String[] args) {
int userNum1;
int userNum2;

userNum1 = -1;
userNum2 = 12;

if(userNum1 < 0)
System.out.println("userNum1 is negative.");


if(userNum2 > 12){
userNum2 = 0;
}
else
System.out.println("userNum2 is less than or equal to 12.");

System.out.println("userNum2 is " + userNum2);

}

}

output
======
userNum1 is negative.
userNum2 is less than or equal to 12.
userNum2 is 12

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