Hi all I am enrolled in abeginners class and am having problems with methods. I keep getting a .class expected and do not know how to fix this. It is at this line that the message appears total = Circle.area(int radius);
.
import javax.swing.JOptionPane;
public class Circle
{
public static void main(String [] args)
{
// double area; ////area to be determined in a method
double radius; //radius inputted by user
String input; //for holding user input
double total;//final area of a circle
//Ask the user for a radius or a circle
input= JOptionPane.showInputDialog("Please enter the radius of the circle ");
//Convet the string input to a double
radius=Double.parseDouble(input);
// this calls the circle method
total = Circle.area(int radius);
JOptionPane.showMessageDialog(null,"The area of the circle is "+total );
}
/*
* The Area method returns the area of the circle
* @param rad the radius inputted by the user
* @param Math.PI the math class
* @return The area of the circle
*/
public static double area (double rad)
{
double area;
area=Math.PI * (rad*rad);
return area;
}
}