-3

As above, I'm trying to make a number to the power of a variable, but it's not working, and is producing the error "The operator ^ is undefined for the argument type(s) double, long".

Here's the line of code:

longSwordCost = 30*(1.3^longSwordCount);

Help!

BipBapApps
  • 73
  • 1
  • 10

1 Answers1

4

You need public static double Math.pow(double a, double b):

http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#pow%28double,%20double%29

The ^ is an XOR logic operator in Java.

AntonH
  • 6,359
  • 2
  • 30
  • 40