Reference command provides the source reference on the last page of a document.
Answer:
- public class Square {
- public static boolean isPerfectSquare(int n){
- int sqrt_n = (int) Math.sqrt(n);
- if(sqrt_n * sqrt_n == n ){
- return true;
- }else{
- return false;
- }
- }
- }
Explanation:
Firstly, use sqrt method from Math package to calculate the square root of input n (Line 3). Cast the result to integer and assign it to sqrt_n variable.
Next, square the sqrt_n and check if it is equal to input n (Line 4). If so, return true, if not, return false (Line 4-8).
Answer:
The code in python is attached.
Explanation:
- A function called CaloriesBurned is defined
- The function accepts 4 inputs: age,weight,heart_rate,time
- Two variables are assigned for the calories burned by men and women
- finally, the function returns the varaibles caloriesburned_men and caloriesburned_women
El Nino is a meteorogycal phenomenom that affects certain areas . My best guess is that computers are used to map in which areas and patterns this phenomenom affects.
Answer:
function result = mypiecewise(a, b, c)
if(c==0)
result=5(a+b);
elseif(c>0)
result=(a*b=c);
else
result=-7;
end
end
Explanation:
It is done in matlab.