Answer:
The code to this question can be given as:
Code:
int callsReceived,operatorsOnCall; //define variable as integer
Scanner ob= new Scanner(System.in);
//create object of scanner class for user input
System.out.println("Insert the value of callsReceived"); //print message.
callsReceived = ob.nextInt(); //input value.
System.out.println("Insert the value of operatorsOnCall"); //print message.
operatorsOnCall = ob.nextInt(); //input value.
if (operatorsOnCall == 0) //check number
{
System.out.println("INVALID"); //print message.
}
else
{
System.out.println(callsReceived/operatorsOnCall); //print value.
}
Explanation:
In the above code firstly we define 2 integer variable that name is already given in the question. Then we create the scanner class object for taking user input. Then we print the message for input first and second value from the user. then we use conditional statement. If the second variable that is operatorsOnCall is equal to 0. So It print INVALID. else it divide the value and print it.
Answer:
The answer to this question is option "d".
Explanation:
In the given question option d is correct because variable-length argument is a new feature in J2SE 5.0 which stands for java 2 standard edition and 5.0 is the version name. It is the variable-length argument lists. A coder can create functions that uses a function to receive several parameter that is not specified. An argument type followed by an ellipsis(...) in the parameter list of a method means that a fixed number of arguments of that particular type is obtained by the method. and other options are not correct that can be given as:
- In option a, we do not need to use the string the variable-length argument list. That's why it is wrong.
- The option b and c are all wrong because in the last parameter the variable-length argument list is used.
That's why the answer to this question is the option "d".
Answer:
for(i = 0 ; i < NUM_VALS; ++i)
{
cout << courseGrades[i] << " ";
}
cout << endl;
for(i = NUM_VALS-1 ; i >=0 ; --i)
{
cout << courseGrades[i] << " ";
}
cout << endl;
Explanation:
The first loop initializes i with 0, because we have to print the elements in order in which the appear in the array. We print each element, adding a space (" ") character at its end. After the loop ends, we add a new line using endl.
The second loop will print the values in a reverse order, so we initialize it from NUM_VALS-1, (since NUM_VALS = 4, and array indices are 0,1,2,3). We execute the loop till i >= 0, and we print the space character and new line in a similar way we executed in loop1.
<u>Answer:</u>
<em>Science fair always has experiments which prove science concepts.</em> Students will bring apparatus or an lab items and show experiments as a magic. There are only certain things which a Science can prove and show to other.
<em>From the given question, the following can be proved:
</em>
- <em>Does pressure have an effect on the volume of a gas?
</em>
- <em>Which brand of soap is the best for cleaning grease off dishes?
</em>
- <em>Which laboratory experiment is the most fun to perform?</em>
<em>
The below cannot be proved but can be explained
</em>
- <em>Is the information on the periodic table difficult to understand?
</em>
- <em>Which physicist was the smartest?</em>