If this is in power point, then she should use the <em>transitions </em>tab on the ribbon. =)
By using cpu-z or the performance ran in taskmgr
Answer:
The method definition to this question can be given as:
Method definition:
public void clear(int[] arr, int num) //define method clear.
{
if (num == 0) //if block
{
return 0; return value.
}
else //else block
{
arr[num - 1] = 0; //assign value in arr.
return arr[]; //return value.
}
}
clear(arr, num - 1); //calling
Explanation:
The description of the above method definition as follows:
- Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
- Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.
Microwave transmission is ideal for long distance communication. It is so good that it is used for satellite and space probe communication.
Answer:
The program to this question can be given as follows:
Program:
//class
public class factorial //defining class
{
//method fact
public static long fact(int x1) //defining method fact
{
//conditional statement
if (x1 <= 1) //if block checks parameter value less then equal to 1
{
return 1; //return value
}
else //else part
{
return (fact(x1 - 1) * (long) x1); //return factors using recursive function
}
}
//method main
public static void main(String[] args) //defining main method
{
long data=fact(5);//defining variable that holds function value
System.out.println("Factorial is: "+data); //print value
}
}
Output:
Factorial is: 120
Explanation:
In the above java program, a class is "factorial" is defined, inside the class, a static method "fact" is declared, that accepts an integer parameter that is "x1" and returns a long value, inside this method a conditional statement is used.
- If the block it checks parameter value is less then equal to 1, if this condition is true, it will return 1 when this condition is not true. It will go in else part.
- In else part, it uses a recursive function to calculate factorial of a number and return its value.
- Then the main method is defined, inside this method a long variable "data" is defined, that call and holds fact function return value, and in the next line, the print function is used to print the data variable value.