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

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 4.9CP
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage