1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elodia [21]
3 years ago
11

Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "non-negative" otherwise. Ex:

If userVal is -9, out
Computers and Technology
1 answer:
ArbitrLikvidat [17]3 years ago
8 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 

 System.out.print("Enter a number: ");

 int userVal = input.nextInt();

 

 String aString;

 if(userVal < 0)

     aString = "negative";

 else

     aString = "non-negative";

     

 System.out.println(aString);

}

}

Explanation:

Ask the user to enter a number and set it to userVal

Check the value of userVal. If it is smaller than 0, set the string as "negative". If it is not, set it as "non-negative"

Print the string

You might be interested in
what are the main technologies that have contributed to be growth and commercialization of the Internet
iren [92.7K]

hope it helps have a good day

5 0
2 years ago
How is photography like jazz music?
Wewaii [24]
LIke jazz, photography has fallings that are being implied to the pictures such as the jazz music. These felling or as there commonly know as soul can make great music and even HD pictures in photography.
7 0
3 years ago
katniss dismisses effie's metaphor because, literally, she knows pearls cannot be created with pressurised coal,they come from w
Marta_Voda [28]

Answer:

oysters

Explanation:

oysters form pearls inside their mouths, it's a very long process, and most oysters never finish or do them

please give brainliest

8 0
3 years ago
Read 2 more answers
Suppose as a computer programmer, you have been assigned a task to develop a program to store the sorted data in ascending order
patriot [66]

Answer: i dont know but have an great day

Explanation:

5 0
3 years ago
. An exception is an error that occurs during the execution of a program at run-time that disrupts the normal fow of the Java pr
In-s [12.5K]

Answer: True

Explanation:Exception error ,which is also known as the fatal error that arises when there is the program execution going-on and the error occurs suddenly to stop the processing, resulting in the abortion of the execution.This erruptional error is responsible for disturbing the execution flow as well as there are chances of the data getting lost or deleted automatically.

5 0
3 years ago
Other questions:
  • What is the name of the process of heat transfer in which heat is transmitted through light waves?
    7·2 answers
  • What do we call a subset of new media in which groups and their fans can interact directly?
    14·1 answer
  • We use a cubic equation in which the variables and coefficients all take on values in the set of integers from 0 through p - 1 a
    8·1 answer
  • Jenny is working on a laptop computer and notices that the computer is not running very fast. She looks and realizes that the la
    14·1 answer
  • Relation between training and occupation with examples in points . Plz tell fast<br> ​
    5·1 answer
  • To speed up the display of graphics, a(n) ________ is integrated into some video cards. select one:
    12·1 answer
  • me pueden ayudar con mi trabajo sii porfss si me dan la respuesta correcta y les doy la mejor coronita si​
    12·1 answer
  • Which of the following is a particularly useful feature of Microsoft PowerPoint and
    8·2 answers
  • (03.05 LC
    14·1 answer
  • Computer science practical on VB.NET. program 1. program to find the square of a number. write the code achieve it​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!