Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 15. Otherwise, print "userNum2 is less than or equal to 15.". End with...


Spot the erros in the following java code and correct to match the instructions:


Print "userNum1 is negative." if userNum1 is less than 0. End with newline.


Assign userNum2 with 4 if userNum2 is greater than 15. Otherwise, print "userNum2 is less than or equal to 15.". End with newline.



Print
15) { userNum2 = 4; } else if (userNum2 < 15)="" {="" system.out.println("usernum2="" is="" less="" than="" or="" equal="" to="" 15.");="" 12="" 13="" 14="" 15="" 16="" 17="" 18="" 19="" 20="" 21="" system.out.println("usernum2="" is="" "="" +="" usernum2);="" }="" 22="" 23="" 24="" 25="" }="" "/="">
Extracted text: Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 15. Otherwise, print "userNum2 is less than or equal to 15.". End with newline. 1 import java.util.Scanner; 2 public class UserNums { 3 public static void main (String [) args) { int userNum1; int userNum2; 4 7 Scanner input = new Scanner(System.in); userNum1 = input.nextInt(); userNum2 = input.nextInt(); 8 9 10 11 if (userNum1 < 0)="" {="" system.out.println("usernum1="" is="" negative.");="" }="" else="" if="" (usernum2=""> 15) { userNum2 = 4; } else if (userNum2 < 15)="" {="" system.out.println("usernum2="" is="" less="" than="" or="" equal="" to="" 15.");="" 12="" 13="" 14="" 15="" 16="" 17="" 18="" 19="" 20="" 21="" system.out.println("usernum2="" is="" "="" +="" usernum2);="" }="" 22="" 23="" 24="" 25="">

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here