[Java]Help my program plz
Right now I am writing a simple java program where a user inputs the radius of a circle and the program, in turn, calculates and displays the diameter, circumference, and area of the circle in a simple message box. nothing about this program is complicated, but this is my first real program and I am having a problem getting it to compile. I keep receiving this error...
Circle.java:7: ';' expected
^
1 error
I have reviewed my code thoroughly and can't find any instance where I am missing a semi-colon. here is my code, please.
// Java Programming Assignment 2.1
// Program to calculate circular circumference, diameter, and area
//Java Packages
import javax.swing.JOptionPane; // use JOptionPane
public class Circle {
// main method begins execution of Java application
public static void main( String args[] )
{
String firstNumber; // first string entered by user
int radius; // radius
int diameter; // radius * 2
int area; // Pi * radius^2
int circumference; // 2 * Pi * radius
int pi;
// read first number from user as a String
firstNumber = JOptionPane.showInputDialog( "Enter radius of a circle" );
// pi value constant
pi = 3.14159;
// convert radius from type String to typ int
radius = Integer.parseInt( firstNumber );
// calculate diameter
diameter = radius * 2;
// calculate area
area= pi * radius * radius;
// calculate circumference
circumference = 2 * pi * radius;
// display result
JOptionPane.showMessageDialog( null, "The Diameter is: " + diameter );
System.exit( 0 ); // terminate application with window
} // end method main
} // end class Circle
It is currently set up to calculate all three results, but only to display the diameter. Also, if you can, please explain how i can get my 3 results to display like this...
Diameter: -------
Circumference: -------
Area: -------
__________________
For Sale.
|