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
Hunter-Best [27]
3 years ago
13

"Consider the following code snippet: int number = 0; Scanner in = new Scanner(System.in); System.out.print(""Enter a number: ""

); number = in.nextInt(); if (number > 30) { . . . } else if (number > 20) { . . .. } else if (number > 10) { . . . } else { . . . } Assuming that the user input is 40, which block of statements is executed?
a. if (number > 30) { . . .}
b. else if (number > 20) { . . .}
c. else if (number > 10) { . . .}
d. else { . . .}
Computers and Technology
1 answer:
Bad White [126]3 years ago
3 0

Answer:

if (number > 30) {. . .}

Explanation:

This code block uses a simple if-elseif-else control structure to do a comparison on a value.  In this type of control structure, each operation of control is check until the correct condition is met, and once the code executes, it exits the control structure, never touching the remainder of the structure.

In this example, we are fortunate that the value triggers the first part of the control structure with if (number > 30) and will execute that section of code.  Once the code finishes, it will exit the structure, never making it to the other 3 control conditions.

Cheers.

You might be interested in
3. Windows that are viewed as Web pages have<br> sections. **
tankabanditka [31]

Answer:

when the when the when the add the when are you is id god his gay for your top off jack dafe cafe read line green red whats the answer

Explanation:

8 0
2 years ago
Read 2 more answers
What is a ribbon in word
nika2105 [10]
A ribbon is somehing ou earn
7 0
3 years ago
Read 2 more answers
Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:
Alika [10]

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int x[]={2,3,4,6,7,8,9,1,11,12};//defining 1-D array and assign value

int i,sum=0;//defining integer variable

for(i=0;i<10;i++)//defining loop for count value

{

   if(x[i]%2==1)//defining if block to check odd value

   {

       sum=sum+x[i];//add value in sum variable

   }

}

cout<<sum;//print sum

return 0;

}

Output:

31

Explanation:

In the above-given program, an integer array "x" is declared that holds some integer values, and in the next line two integer variable "i and sum" is defined which is used to calculate the value.

In the next line, a for loop is declared, that counts all array value, and it uses the if block to check the odd value and add all the value into the sum variable.

5 0
2 years ago
Write the code for invoking a method named sendObject. There is one argument for this method which is of type Customer. Assume t
kodGreya [7K]

Answer:

sendObject(John_Doe);

Explanation:

The above code has been written in Java.

Since the calling class is the same that declares it, to invoke the method, simply call its name with its argument(s) in a pair parentheses. The name of the method is "sendObject" and its argument is a reference to an object of type Customer saved in a variable called "John_Doe". This can be written as follows:

sendObject(John_Doe);

Hope this helps!

3 0
3 years ago
How are the current and resistance related when the voltage of a circuit is constant?
andreev551 [17]
Since resistance and current are inversely proportional, when the resistance doubles, the current is cut in half.
5 0
2 years ago
Read 2 more answers
Other questions:
  • Computers spend most of their time in loops, so multiple loop itera- tions are great places to speculatively find more work to k
    10·1 answer
  • Julio is the department head for his company's customer service department. His staff has complained that they spend countless h
    13·2 answers
  • It can be useful to have a mentor because they will help you
    7·2 answers
  • Which password is an ideal and secure password?
    6·2 answers
  • How to make your keyboard sound like a piano?
    9·1 answer
  • You are going to be installing a videoconferencing system. One of the requirements of the system is that only workstations that
    10·1 answer
  • Such a class might store information about the account balance, the name of the account holder, and an account number. What inst
    13·1 answer
  • Chose the term that matches each definition.
    15·1 answer
  • Your supervisor has asked you if it is possible to monitor servers for potential port scans via SNMP. What two OIDs can you prov
    13·1 answer
  • Type the correct answer in the box. Spell all words correctly. Kenny is designing a document for the employee motivation campaig
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!