Question: Jump to level 1 Define a method printPowerOf 2 ( ) that takes two double parameters, and outputs Result: followed by the result of

Jump to level 1
Define a method printPowerOf2() that takes two double parameters, and outputs "Result: " followed by the result of raising the first parameter to the power of the second parameter with a precision of two digits as follows, ending with a newline.
Ex: If the input is 10.501.00, then the output is:
Result: 10.50
Note:
Recall Math.pow (x,y) returns x to the power of y. Ex: Math.pow(6.0,2.0) evaluates to 36.0.
Use system.out.printf ("%.2f, myDouble) to output doubles with precision of two digits.
import java.util.Scanner;
public class Powerof2{
Y* Your code goes here */
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
double x;
double y;
x= scnr.nextDouble();
y= scnr.nextDouble();
printPowerof2(x,y);
}
}
 Jump to level 1 Define a method printPowerOf2() that takes two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!