Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: what is wrong with my code its not running

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default what is wrong with my code its not running

    class carpcalculate{
    public static double Perimeter(double l, double b){
    double p=2*(l+b);
    return p;
    }

    public static double Area(double l, double b){
    double a=l*b;
    return a;
    }
    public static double Volume(double l, double b,double h){
    double v=l*b*h;
    return v;
    }
    }


    import javax.swing.JOptionPane;
    class carpDemo{
    public static void main(String args[]){
    carpcalculate cc = new carpcalculate();
    double l, b, h;
    String a=JOptionPane.showInputDialog("please enter the length");
    l=Double.parseDouble(a);
    String x=JOptionPane.showInputDialog("please enter the breadth");
    b=Double.parseDouble(x);
    String y=JOptionPane.showInputDialog("please enter the heigth");
    h=Double.parseDouble(y);
    JOptionPane.showMessageDialog("null,your perimeter is+cc.Perimeter(l,b)");
    JOptionPane.showMessageDialog("null,your area is+cc.Area(l,b)");
    JOptionPane.showMessageDialog("null,your volume is+cc.Volume(l,b,h)");

    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: what is wrong with my code its not running

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    Please explain. If there are error messages, copy the full text and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: November 26th, 2013, 05:41 AM
  2. [SOLVED] n00b having problems running code
    By cha0s619 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: November 10th, 2012, 03:31 PM
  3. help needed to know how the code is running
    By Dark knight in forum Java Theory & Questions
    Replies: 9
    Last Post: July 30th, 2012, 06:18 PM
  4. need to know how the code is running
    By Dark knight in forum Java Theory & Questions
    Replies: 3
    Last Post: July 19th, 2012, 09:28 AM
  5. I cannot get this loop to stop running. What am I doing wrong??
    By Nismoz3255 in forum Loops & Control Statements
    Replies: 2
    Last Post: May 1st, 2011, 10:28 PM