Errors in Math.pow in Java

I'm obviously just learning programming, and I can't figure out what to do to get rid of this error. The error is on the second to the last line - the line before: [System.out.print (+ windChill);]

Here (written a bit below) there is a list of "possible hints" generated by Java for the errors that I get:

** ')' expected
method pow in class java.lang.Math cannot be applied to given types
  required: double, double
  found: double
method pow in class java.lang.Math cannot be applied to given types
  required: double, double
  found: double
operator + cannot be applied to double, pow
incompatible types
  required: doub ... **

Any hints or clarifications would be most appreciated. See code below. Thank you in advance.

Shane

import java.util.Scanner;
public class Main {

   public static void main(String[] args) {
        // TODO code application logic here
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a temperature between -58 and 41 degrees Fahrenheit and press ENTER");
        double temperature = input.nextDouble();
        System.out.print("Enter a wind speed that is 2 miles per hour or faster and press ENTER");      
        double windSpeed = input.nextDouble();
        double windChill = (((35.41 + temperature - Math.pow(windSpeed * 16) + Math.pow(temperature * 16)));
        System.out.print(+windChill);

    }

}
+3
source share
5 answers

(((35.41 + temperature - Math.pow(windSpeed * 16) + Math.pow(temperature * 16)))

Math.pow . .

Math.pow(windSpeed,16)?

Math.pow   public static double pow(double a,double b) , .

, .

+7

, ) ,

double windChill = (((35.41 + temperature...

( =, , , .

+1

Math.pow , x^y x y, . ?

0

:

 double windChill = (((
                    ^

, ) .

0
source

The Math.pow function needs two arguments: base and strength. You pass only one value - windSpeed ​​and 16. I think you probably mean:

Math.pow(windSpeed, 16)
0
source

Source: https://habr.com/ru/post/1766690/


All Articles