answer.
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]
2 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]2 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
There is a file "IT4983" in my home (personal) directory. I don’t know my current working directory. How can I find out the file
RoseWind [281]

Answer and Explanation:

Find / -name "IT4983"

See what it will do is it will find the file named IT4983 in the root directory.

run this commmand with sudo just in case for permission issues.

then it will give you the location of that file we want to find.

 

Or

$ file /home/IT4983 ( you can type this command from whichever directory you are )

output : IT4983 , ASCII TEXT

3 0
2 years ago
As a security engineer, compare and contrast the pros and cons of deploying hetero vs homogenous networks. Which costs more? Whi
Mama L [17]

Answer:

See below

Explanation:

In case of a homogeneous network, Skype is an example and OpenTable is an example of a heterogeneous network.

<u>Homogeneous</u> networks are easier to get started with since its all pre-integrated, and even the troubleshooting is more convenient if a problem arises. However, it then becomes a security concern if you choose to place all that power to a single vendor - known as ' monoculture'. One event can affect the entire network. On the other hand, a <u>heterogeneous</u> set up does not run this risk. Several different components are utilized which are not as vulnerable to security threats.

In conclusion, homogeneous networks cost more and heterogeneous networks are more secure.

8 0
2 years ago
What is computer? Explain the characteristics of computer.<br>​
Misha Larkins [42]

Answer:

What Is Computer? Here's Why: The characteristics of computers that have made them so powerful and universally useful are speed, accuracy, diligence, versatility and storage capacity. Let us discuss them briefly. Computers work at an incredible speed. A powerful computer is capable of performing about 3-4 million simple instructions per second.

Explanation:

6 0
2 years ago
A _______ is a shortcut to a web page saved in a list in the internet explorer desktop application.
elena-14-01-66 [18.8K]
It is called a favorite
6 0
2 years ago
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being
LenKa [72]
The skill thar is being displayed I thing is being outgoing and loyal
6 0
2 years ago
Read 2 more answers
Other questions:
  • What is the other name designated to a game master of multiplayer online games (MMOs)?
    11·2 answers
  • Tina reported a safety hazard at her workplace to OSHA. Representatives from OSHA
    5·1 answer
  • The spreadsheet below shows the names years in office, and number of terms for five US presidents
    7·2 answers
  • Suppose a computer using direct mapped cache has 220 bytes of byte-addressable main memory, and a cache of 32 blocks, where each
    5·1 answer
  • What technology gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses?
    14·1 answer
  • Collaboration online increases students' motivation by
    5·2 answers
  • Janice has a "jammed" key on her keyboard. Every time she strikes the "S" key it sticks and doesn't pop back. What should Janice
    6·2 answers
  • Alice just wrote a new app using Python. She tested her code and noticed some of her lines of code are out of order. Which princ
    8·1 answer
  • Describe the ways in which a computer-aided design (CAD) drawing makes the details of an image easier to understand.
    11·2 answers
  • **Click the photo** Put the steps in order to produce the output shown below. Assume the indenting will be correct in the progra
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!