Ask Question
17 January, 06:32

Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8. Otherwise, print "userNum2 is less than or equal to 8 ... End with newline. 1 public class UserNums 2public static void main (String args) int userNum1; int userNum2 userNumt - - 1; userNum2 7; Your solution goes here / 10 System. out. printin ("userNum2 is "userNum2);

+5
Answers (1)
  1. 17 January, 10:15
    0
    import java. util. Scanner;

    public class num1 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter User name 1 and 2");

    int userNum1 = in. nextInt ();

    int userNum2 = in. nextInt ();

    if (userNum1<0) {

    System. out. println ("userNum1 is negative.");

    }

    else if (userNum2>8) {

    userNum2 = 0;

    }

    else{

    System. out. println ("userNum2 is less than or equal to 8 ... ");

    }

    }

    }

    Explanation:

    This is implemented in Java programming language

    Using the scanner class, the user is prompted to enter two numbers

    These are saved in the variable userNum1 and userNum2 respectively.

    If, else if and else statements are then used according to the specifications given in the question.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8. Otherwise, ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers