#Help with this question.Given three floating-point numbers x, y, and z, output x to the power of z,

1 messages · Page 1 of 1 (latest)

quaint laurel
#

import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double x;
double y;
double z;
/* Type your code here. */
}
}

edgy mirageBOT
#

<@&987246399047479336> please have a look, thanks.

next parrot
#

@quaint laurel do u know how to use scanner?

spare pond
#

You'd probably want something that looks like this:

import java.util.Scanner;

public class LabProgram {
    public static void main(String[] args) {
       Scanner scnr = new Scanner(System.in);
       double x;
       double y;
       double z;

        System.out.print("Enter the value of x: ");
        x = scnr.nextDouble();

        System.out.print("Enter the value of y: ");
        y = scnr.nextDouble();

        System.out.print("Enter the value of z: ");
        z = scnr.nextDouble();

        double result = Math.pow(x, z);

        System.out.println(x + " raised to the power of " + z + " is: " + result);

        scnr.close();
    }
 }
#

Do you know how to use Scanner?

thick crater
spare pond
quaint laurel
#

its not as easy as it looks because the thing always returns random values for me

spare pond
#

What does your code look like then?

quaint laurel
#

i pretty much had to use the math library in a specfic way

thick crater