Originally Posted by
xsinx
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)
...