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
Reptile [31]
1 year ago
8

What is a conditional statement? What is another name for conditional statement? Give 2 examples of conditional statements?

Computers and Technology
1 answer:
vlada-n [284]1 year ago
8 0

Answer:

A conditional statement instructs a system to do action based on whether a condition is true or false. This is frequently expressed as an if-then or if-then-else expression. A conditional statement is applied to predicate choices on circumstances. When there is no condition around the instructions, they run sequentially. If you add a condition to a block of statements, the execution flow may alter depend on the outcome of the condition. It is also known as a one-way selection statement because we utilize the if condition, provide the argument, and if the argument is passed, the relevant function is performed; else, nothing happens. 

Examples of conditional statements:

1)<em> int time = 20;</em>

<em>if (time < 16) {</em>

<em>  System.out.println("Have a good day.");</em>

<em>} else {</em>

<em>  System.out.println(" Enjoy your evening.");</em>

<em>}</em>

<em />

2) <em>using namespace Conditional;</em>

<em>static void Main(string[] args) </em>

<em>{</em>

<em>  // This method determines what a user should do for the day based on the weather condition </em>

<em />

<em>  public void Weather(string myWeather)</em>

<em>  {</em>

<em>    // 1st condition</em>

<em>    if (myWeather == "Sun")</em>

<em>    {</em>

<em>      // Decision</em>

<em>      Console.WriteLine("Go to the beach");</em>

<em>    }</em>

<em>    // 2nd condition</em>

<em>    else if (myWeather == "Rain")</em>

<em>    {</em>

<em>      Console.WriteLine("Go to the library")</em>

<em>    }</em>

<em>    // 3rd condition</em>

<em>    else if (myWeather == "Cloudy")</em>

<em>    {</em>

<em>      Console.WriteLine("Go to the park")</em>

<em>    }</em>

<em>    else</em>

<em>    {</em>

<em>      //otherwise</em>

<em>      Console.WriteLine("Rest at home")</em>

<em>    }</em>

<em>  }</em>

<em>}</em>

You might be interested in
Questions: What memory modules are needed if the customer wants 3 GB of RAM? What capacities and how many modules of each capaci
zhannawk [14.2K]

Answer:

You could use three 1 GB modules.

4 0
2 years ago
Write a program to read a list of exam scores given as integer percentages in the range 0-100. Display the total number of grade
Tju [1.3M]

Answer:

import java.util.Scanner;

public class Program

{

  public static void main(String [] Args)

  {

      int totalAGrades = 0, totalBGrades = 0, totalCGrades = 0, totalDGrades = 0, totalFGrades = 0, counter=0,maximum = 0, minimum = 9999, num, total = 0,smallest = 0,largest = 0;

       Scanner in = new Scanner(System.in);

       System.out.println("Enter exam percentage: ");

       System.out.println("Enter a negative examScore: ");

       int examScore = in.nextInt();

       while(examScore > 0)

       {

         counter++;

         if(examScore < 0){          

             break;}  

         else if(examScore > maximum){      

              maximum = examScore;}

         else if(examScore < minimum)   {  

              minimum = examScore;}

         

          total = total + examScore;  

     

          if(examScore <= 50 && examScore>0)

              smallest = examScore;

              if(examScore > 90 && examScore <=100)

              largest = examScore;

         

      if(examScore>=90 && examScore<=100)

          totalAGrades++;

      else if(examScore>=80 && examScore<=89)

          totalBGrades++;

      else if(examScore>=70 && examScore<=79)

          totalCGrades++;

      else if(examScore>=60 && examScore<=69)

          totalDGrades++;

      else if(examScore>=0 && examScore<=59)

          totalFGrades++;

      examScore = in.nextInt();

     

   }

      System.out.println("Total number of scores is = " + counter );

      System.out.println("Total Number of each Letter grade : " + counter);

      System.out.println("Percentage of total for each letter grade : ");

          System.out.println("Total number of A grades = "+ totalAGrades);

          System.out.println("Total number of B grades = "+ totalBGrades);

          System.out.println("Total number of C grades = "+ totalCGrades);

          System.out.println("Total number of D grades = "+ totalDGrades);

          System.out.println("Total number of F grades = "+ totalFGrades);

     

      System.out.println("Lowest exam Score is :"+smallest);

      System.out.println("Highest exam Score is :"+largest);

      System.out.println("Average exam Score = "+ (total / counter));

  }

}  

Explanation:

  • Get the exam information from user as input and run a while loop until examScore is greater than zero.
  • Use conditional statement to check the scores of students and increment the relevant grade accordingly.
  • Finally display all the information including grades and scores.
3 0
3 years ago
Design a chip that can complete four bit binary addition, subtraction, and, or operation. Complete the Verilog program and show
marissa [1.9K]

Answer:

How am I supposed to design a chip here?

Explanation:

5 0
2 years ago
Read 2 more answers
What is a quick way to determine if a site might contain reliable information?
xz_007 [3.2K]
<span>The best and most correct answer among the choices provided by the question is the fourth choice.

A way of determining that a site is realiable is examining comments about the <span>webpage.</span></span><span>
I hope my answer has come to your help. God bless and have a nice day ahead!</span>
5 0
2 years ago
Read 2 more answers
Which of the following remote access security technologies performs authentication through a three-way handshake (that is, chall
levacccp [35]

Answer:

CHAP

Explanation:

CHAP allows a client to be authenticated without sending credential information across a network.

7 0
3 years ago
Other questions:
  • Which two approaches optimize test maintenance and support future declarative configuration changes? Choose 2 answers Create a m
    8·1 answer
  • Di bawah ini tampilan submenu pada tab menu insert pada microsoft word 2010,yaitu...
    6·1 answer
  • What is is the privacy risks with health care robots?
    8·1 answer
  • Define a Python function called leng_of_str to calculate the length of a string (Hint: Do not use the len function to find the l
    14·1 answer
  • John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows his to access
    5·1 answer
  • As a general rule, the number of bullet points on a slide should not exceed _____. a.2 b.4 c.8 d.10
    9·1 answer
  • Describe a situation in which a robot may have to avoid an obstacle without coming to a complete stop before turning.
    10·2 answers
  • Assume you are using the text's array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements and
    13·1 answer
  • Vivek wants to save the data about his grocery store in a single table. Which among the following type of databases is used in t
    7·1 answer
  • I'm not sure how to solve this problem
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!