- #1
UltimateSomni
- 62
- 0
Math.PI comes up with "cannot find symbol" error
class Pi {
public static void main (String[] args) {
float radius=Float.parseFloat(args[0]);
float shortPi=(float) Math.PI;
float circ= shortPi *(radius+radius);
float area= shortPi *(radius*radius);
System.out.print("with Pi commuted from " +Math.PI);
System.out.println(" to " + shortPi + "...");
System.out.println("A circle radius of " + circ + " cm");
System.out.print("has a circumference of " +area+ "sq.cm");
}}
_______________________________________________________
I get two "cannot find symbol" errors, both of which point to the use of Math.PI. Is there something else I need to do? Math.PI is suppose to be constant value worth 3.141592653589793
class Pi {
public static void main (String[] args) {
float radius=Float.parseFloat(args[0]);
float shortPi=(float) Math.PI;
float circ= shortPi *(radius+radius);
float area= shortPi *(radius*radius);
System.out.print("with Pi commuted from " +Math.PI);
System.out.println(" to " + shortPi + "...");
System.out.println("A circle radius of " + circ + " cm");
System.out.print("has a circumference of " +area+ "sq.cm");
}}
_______________________________________________________
I get two "cannot find symbol" errors, both of which point to the use of Math.PI. Is there something else I need to do? Math.PI is suppose to be constant value worth 3.141592653589793