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
ivolga24 [154]
3 years ago
4

What is an IF statement used for? Select all that apply.

Computers and Technology
1 answer:
Vika [28.1K]3 years ago
8 0

<em>The IF statement is used for: </em><em>True/False decisions to count </em><em>&</em><em> to Select between options in a program. </em>

<em>IF statement is known for decision making statement. Meaning to say, programmers used it to have an output based on decision (TRUE and FALSE). Only one final output or decision will be presented depending on the condition made. For example: The person would like to know if he can vote. According to some national rules, a person can vote if he is 18 years old and above. To do that using IF statement (in Java): </em>

<em> </em>

<em>if(age>=18) </em>

<em>{ </em>

<em>System.out.println("You can vote"); </em>

<em>} </em>

<em> </em>

<em>The condition is age >=18 meaning, if age is higher or equivalent to 18, it will produce a statement "You can vote". The TRUE value is when the condition is met or satisfied. </em>

<em>IF statement supports multiple TRUE values as well. You can add two scenario on the example above: When the user input his age, the program will say that he can vote and he cannot vote : </em>

<em> </em>

<em>if age(age>=18) </em>

<em>{ </em>

<em>System.out.println("You can vote"): </em>

<em>{ </em>

<em>if (age<18) </em>

<em>{ </em>

<em>System.out.println("You cannot vote"); </em>

<em>} </em>

<em> </em>

<em> </em>

<em> </em>

<em />

You might be interested in
In this lab, you will implement a temperature converter in JavaScript. The user may type a temperature in either the Celsius or
jek_recluse [69]

Use the knowledge in computational language in JAVA to write a code that convert the temperature.

<h3>How do I convert Celsius to Fahrenheit in Java?</h3>

So in an easier way we have that the code is:

  • Fahrenheit to celsius:

<em>/* When the input field receives input, convert the value from fahrenheit to celsius */</em>

<em>function temperatureConverter(valNum) {</em>

<em>  valNum = parseFloat(valNum);</em>

<em>  document.getElementById("outputCelsius").innerHTML = (valNum-32) / 1.8;</em>

<em>}</em>

  • Celsius to Fahrenheit:

<em>function cToF(celsius) </em>

<em>{</em>

<em>  var cTemp = celsius;</em>

<em>  var cToFahr = cTemp * 9 / 5 + 32;</em>

<em>  var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';</em>

<em>    console.log(message);</em>

<em>}</em>

<em>function fToC(fahrenheit) </em>

<em>{</em>

<em>  var fTemp = fahrenheit;</em>

<em>  var fToCel = (fTemp - 32) * 5 / 9;</em>

<em>  var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';</em>

<em>    console.log(message);</em>

<em>} </em>

<em>cToF(60);</em>

<em>fToC(45);</em>

See more about JAVA at brainly.com/question/12975450

5 0
2 years ago
Câu 4. Trong môi trường lập trình CodeBlocks phím F9 dùng để: A. Biên dịch chương trình B. Chạy chương trình C. Soạn thảo chương
Debora [2.8K]

Answer:

câu trả lời là c nha

Explanation:

7 0
3 years ago
Jeremy forgot where he saved a certain file on her computer. Therefore, he searches for all files with a .jpg file extension. Wh
Irina-Kira [14]
The jpg (or jpeg) extension stands for <span>Joint Photographic Experts Group. A file with this extension is an image, usually a photo. Other types of images are better stored using a lossless format.</span>
4 0
3 years ago
Read 2 more answers
Bottom-up integration testing has as it's major advantage(s) that
irakobra [83]
It's C) no stubs need to be written
8 0
3 years ago
Help !!!!!
viva [34]
I believe it’s D because software is the programs and other operations used by a computer
3 0
3 years ago
Other questions:
  • As part of the interview process should you compose a thank-you note for the prospective employer and/or interview committee. In
    6·1 answer
  • What is the purpose of filters in a database?
    15·1 answer
  • Can someone explain to me what coom means? kekw
    12·1 answer
  • Which is most harmful computer virus define​
    15·1 answer
  • Now, Kim wants to add the technical terms she typically misspells to the PowerPoint built-in list. Which option should she use t
    15·2 answers
  • How would you define a relational database ?
    12·1 answer
  • Write a class named GasTank containing: An instance variable named amount of type double, initialized to 0. An instance variable
    13·1 answer
  • In UML behavioral modeling, a message is _____. (Points : 6) a named location in memory where information is deposited and retri
    7·1 answer
  • A printer would be considered _____. Select 2 options. 1 an input device 2 an output device 3 hardware 4 software 5 storage
    10·1 answer
  • . Write the advantages and disadvantages of CLI?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!