Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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);
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

When should the last word in a title be capitalized?

Answered: 1 week ago