Answer:
import java.util.Scanner;
public class num8 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter first number");
int X = in.nextInt();
System.out.println("Enter second number");
int Y = in.nextInt();
int Z;
if(X <= Y){
Z = 0;
}
else if(X >= Y){
Z = 1;
}
}
}
Explanation:
- The program is implemented in Java
- In order to set the values for X and Y, The Scanner class is used to receive and store the values in the variables (Although the questions says you should assume these values are set)
- The if conditional statement is used to assign values (either 0 or 1) to variable Z as required by the question.
Multiple research has been conducted with regards to this point of view, but the common conclusion is that it depends more on the platform. People tend to be more dishonest when not comfortable and when given the chance live off their fantasy even for short while online. We all do agree that an example is the social media where in order to get attention we only share positive things. You might want to check speaker Simon Sinek and see rich views and in depth understanding of how technology has changed us.
Explanation:
The second for loop does 1 of 4 iterations for every 1 of 5 iterations of the parent loop. meaning it is 4 x 5 which is 20.
Answer:
Replace /* Your solution goes here */ with:
cin>>matchValue;
numMatches = 0;
for (i = 0; i < userValues.size(); ++i) {
if(matchValue == userValues.at(i))
{
numMatches++;
}
}
Explanation:
This line gets input for matchValue
<em>cin>>matchValue;
</em>
This line initializes numMatches to 0
<em>numMatches = 0;
</em>
The following iteration checks for the number of matches (numMatches) of the matchValue
<em>for (i = 0; i < userValues.size(); ++i) {
</em>
<em>if(matchValue == userValues.at(i))
</em>
<em>{
</em>
<em> numMatches++;
</em>
<em>}
</em>
<em>}
</em>
<em>See Attachment for full source code</em>
Answer:
answer is D
Explanation:
as the block returns the number of array members, the most likely scenario is the last one.