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: help me pls (beginner)

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    3
    My Mood
    Asleep
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help me pls (beginner)

    import javax.swing.JOptionPane;
    public class Polygons{
    public static void main(String[] args){

    j=JOptionPane.showInputDialog(sides);

    if(sides == 3)
    r=JOptionPane.showMessageDialog("The Polygon is a TRIANGLE");
    if else if(sides == 4)
    r=JOptionPane.showMessageDialog("The Polygon is a PPARALLELOGRAM");
    if else if(sides == 5)r=JOptionPane.showMessageDialog("The Polygon is a PENTAGON");
    if else if(sides == 6)
    r=JOptionPane.showMessageDialog("The Polygon is a HEXAGON");
    if else if(sides == 7)
    r=JOptionPane.showMessageDialog("The Polygon is a HEPTAGON");
    if else if(sides == 8)
    r=JOptionPane.showMessageDialog("The Polygon is a OCTAGON");
    if (sides == 9)
    r=JOptionPane.showMessageDialog("The Polygon is A NONAGON");
    if else if(sides == 10)
    r=JOptionPane.showMessageDialog("The Polygon is a DECAGON");
    }
    }



    anybody help me plss complete my project >.<
    Last edited by xsinx; July 21st, 2012 at 02:24 AM.


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    119
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Default Re: help me pls (beginner)

    Quote Originally Posted by xsinx View Post
    import javax.swing.JOptionPane;
    public class Polygons{
    public static void main(String[] args){

    j=JOptionPane.showInputDialog(sides);

    if(sides == 3)
    r=JOptionPane.showMessageDialog("The Polygon is a TRIANGLE");
    if else if(sides == 4)
    r=JOptionPane.showMessageDialog("The Polygon is a PPARALLELOGRAM");
    if else if(sides == 5)r=JOptionPane.showMessageDialog("The Polygon is a PENTAGON");
    if else if(sides == 6)
    r=JOptionPane.showMessageDialog("The Polygon is a HEXAGON");
    if else if(sides == 7)
    r=JOptionPane.showMessageDialog("The Polygon is a HEPTAGON");
    if else if(sides == 8)
    r=JOptionPane.showMessageDialog("The Polygon is a OCTAGON");
    if (sides == 9)
    r=JOptionPane.showMessageDialog("The Polygon is A NONAGON");
    if else if(sides == 10)
    r=JOptionPane.showMessageDialog("The Polygon is a DECAGON");
    }
    }



    anybody help me plss complete my project >.<
    You coded very wrong "if .... if else if ..." the bold if is wrong and must be discarded
    if (side==1)
    ...
    else if (side==2)
    ...

Similar Threads

  1. Beginner
    By mkarthik90 in forum Member Introductions
    Replies: 1
    Last Post: February 18th, 2012, 02:26 PM
  2. I am a beginner please help :)
    By mvonb17 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 6th, 2012, 03:44 PM
  3. Beginner
    By codejava in forum Member Introductions
    Replies: 2
    Last Post: August 22nd, 2011, 08:11 AM
  4. Beginner
    By angelo24 in forum Member Introductions
    Replies: 1
    Last Post: August 19th, 2011, 07:14 AM
  5. I need a help ! i am beginner
    By yinky in forum Java Theory & Questions
    Replies: 3
    Last Post: September 30th, 2009, 07:22 AM