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
Evgen [1.6K]
4 years ago
5

Write the definition of a function power_to, which receives two parameters. The first is a float and the second is an integer. T

he function returns a float. If the second parameter is negative, the function returns zero. Otherwise it returns the value of the first parameter raised to the power of the second.
Computers and Technology
1 answer:
Ber [7]4 years ago
3 0

Answer:

  1.    public static double power_2(double num1, int num2){
  2.        if(num2<0){
  3.            return 0;
  4.        }
  5.        else{
  6.            double returnedVal = Math.pow(num1,num2);
  7.            return returnedVal;
  8.        }
  9.    }

Explanation:

  • This is implemented in Java programming language
  • Line 1 Is the method declaration which indicates that it will return a floating point number (type double) and accepts two parameters, the first a double and the second an int as required by the question
  • Line 2 Uses and if statement to check if the second parameter is negative (less than 0) and returns 0.0 if this is true
  • Lines 5-7 is the else condition that uses java's Math.pow method to raise the num1 to the power num2 and returns the value
You might be interested in
What can be said about the equipment used by photographers during the Civil War?
lilavasa [31]
The answer is 1 and 4
6 0
3 years ago
Read 2 more answers
Questlon 5 of 25
Solnce55 [7]

Answer:

sorry maam/sir i wish i could help but i dont know how to answer that

Explanation:

because im middle school

3 0
3 years ago
Assignment 4: Evens and Odds
Marrrta [24]
Wow that is really long
4 0
3 years ago
HTML code to display square bullets in an unordered list​
Solnce55 [7]

Answer:

<!DOCTYPE html>

<html>

<body>

<h2>Unordered List with Square Bullets</h2>

<ul style="list-style-type:square;">

 <li>Coffee</li>

 <li>Tea</li>

 <li>Milk</li>

</ul>

</body>

</html>

5 0
3 years ago
MmfbfMMMMMMMMMMMMMMMMMmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Mumz [18]

Explanation:

bdhabsusvsjsvdhewjsbdueyssbwksv

6 0
3 years ago
Other questions:
  • When a file has been opened using the 'r' mode specifier, which method will return the file's contents as a string??
    12·1 answer
  • Can some one fix this <br> input ("Enter a number: ") <br> print (num * 8)
    9·1 answer
  • Given the list my_list containing integers, create a list consisting of all the even elements of my_list. Associate the new list
    12·1 answer
  • Which VPN topology is also known as a hub-and-spoke configuration?
    15·1 answer
  • The column boundary, the border to the right of a column, can be dragged until a row is at a desired height. true or false
    14·1 answer
  • HELP ME PLEASEEEE
    8·1 answer
  • HELPPPPP Which tag used to add a new line:<br> A. ol<br> B. P<br> C. h1<br> D li
    7·1 answer
  • Moving images of real event​
    12·2 answers
  • What is it called when a programmer includes a step in an algorithm that lets
    5·1 answer
  • A(n) ____ is system software. Group of answer choices word processing program presentation graphics program operating system spr
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!