•

Check out our Community Blogs

Register and join over 40,000 other developers!

### Recent Blog Entries

• phi

I love this community !

• JackJames

hi i am jack i am seo expert jack james would love you to read new post

# Debug problem

debug

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

### #1 RonLevitzky

RonLevitzky

CC Lurker

• New Member
• 6 posts

Posted 10 October 2015 - 04:13 PM

hi there,

i have a debug problem that i need to solve for school but am having troubles understanding one of the lines, and was hoping someone could explain what it does.

the code is:

import javax.swing.JOptionPane;
public class DebugTest
{
public static void main(String[] args)
{
double PI = 3.14;
double area = 0.0;
double circumference = 0.0;
radiusString = JOptionPane.showInputDialog("Enter the radius of"        // cleaned up code because it was too long
+ " a circle to calculate the area: ");
circumference = calculateCircumference(area);
outputResult();
System.out.println("End of Processing...");
}
public void calculateArea(double radius, double PI)
{
}
public void calculateCircumference(double area)
{
double result = Math.sqrt(area / PI) * PI * 2;
}
public static void outputResult()
{
JOptionPane.showMessageDialog(null, "The area of the circle is:" + area);
JOptionPane.showMessageDialog(null, "The circumference of the circle is: " + circumference);
}
}

line 14 and 15 shop\w up red in my editor and im not sure how to fix them because i dont know what they mean,

circumference = calculateCircumference(area);

thanks,
ron

### #2 RonLevitzky

RonLevitzky

CC Lurker

• New Member
• 6 posts

Posted 10 October 2015 - 06:06 PM

to be more specifice, i dont understand what the parameter "radius" does.

### #3 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 11 October 2015 - 09:58 AM

They're calling functions you probably need to write.

Area = pi*r*r

Circumference = 2*pi*r

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #4 RonLevitzky

RonLevitzky

CC Lurker

• New Member
• 6 posts

Posted 11 October 2015 - 10:13 AM

But i thought those were defined within the methods. Still not quite sure on how to solve this.

### #5 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 12 October 2015 - 04:15 AM

Ah, I missed them. Do you actually get any compiler errors?

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download