Question: CHALLENGE ACTIVITY 3.14.2: Conditional expression: Print negative or positive. Create a conditional expression that evaluates to string 'negative if userval is less than 0, and

 CHALLENGE ACTIVITY 3.14.2: Conditional expression: Print negative or positive. Create a

CHALLENGE ACTIVITY 3.14.2: Conditional expression: Print negative or positive. Create a conditional expression that evaluates to string 'negative" if userval is less than 0, and "non-negative' otherwise. Ex: If userval is 9, output is: -9 is negative. Test vused Altea 5 : 11 1 import java.util.Scanner; 2 3 public class NegativeOrPositive { 4 public static void main (String args) { 5 Scanner scnr = new Scanner(System.in); 6 String condStr; 7 int userval; 8 9 userval = scnr.nextInt(); 10 11 condStr - V* Your solution goes here */; 12 13 System.out.println(userval + " is " + condStr + "."); 14 } 153 Run

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!