I need help with this java code: Print negative or positive.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 8RQ: What is the output of the following code segment?inte=5,f=10;if(eff0)Write(Purple)...
icon
Related questions
Question

I need help with this java code: 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.
Replace the code comment /* Your solution goes here */ with your solution. The rest of the code, including the semicolon,
cannot be edited.
Learn how our autograder works
512128.2827818.qx3zqy7
1 import java.util.Scanner;
2
3 public class NegativeOrPositive {
4
5
6
7
8
9
10
의 물의 딸음밥
11
12
13
14
15}
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
String condStr;
int userVal;
userval = scnr.nextInt ();
condStr = * Your solution goes here */;
System.out.println(userVal + is "condStr + ".");
}
Transcribed Image Text: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. Replace the code comment /* Your solution goes here */ with your solution. The rest of the code, including the semicolon, cannot be edited. Learn how our autograder works 512128.2827818.qx3zqy7 1 import java.util.Scanner; 2 3 public class NegativeOrPositive { 4 5 6 7 8 9 10 의 물의 딸음밥 11 12 13 14 15} public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String condStr; int userVal; userval = scnr.nextInt (); condStr = * Your solution goes here */; System.out.println(userVal + is "condStr + "."); }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,