package cs1410;
import javax.swing.*;


public class P2 {




    public static void main(String []args)
    {
         drawDiamond();    


    }


    public static void drawDiamond()
    {
        int x,y,z;
        int a=1;
        String out="\n";

        int i=Integer.parseInt(JOptionPane.showInputDialog("Enter your size"));
        if((i%2)!=0)
        {
             int in=(i/2)+(i%2);
             int bb=in-1;
             int b=bb+(bb-1);

             for(x=in;x>0;x--)
             {
                 for(y=x;y>1;y--)
                     out+=" ";

                for(z=0;z<a;z++)
                    out+="*";
                    a+=2;
                    out+="\n";
             }

             for(x=0;x<in-1;x++)
             {

                 for(y=x;y>=0;y--)
                     out+=" ";

                 for(z=0;z<b;z++)
                    out+="*";
                    b-=2;
                    out+="\n";
             }


             System.out.print(out);
             drawDiamond();
        }
        else
        {
                System.out.print("Please enter an odd number");
                drawDiamond();
        }
        }
}

    for (int i = 0; i < 20; i++)
    {
    System.out.print(" ");
    }
    for (int i = 0; i < 20; i++)
    {
    System.out.print("*");
    }
    System.out.println();
    for ( int k = 0; k < 4; k++){
    for ( int j =19 - k ; j>0; j--)
    {
    System.out.print(" ");
    }
    System.out.print("*");

    for (int i = 0; i < 18; i++)
    {
    System.out.print(" ");
    }
    System.out.println("*");
    }
    for (int i = 0; i < 15; i++)
    {
    System.out.print(" ");
    }
    for (int i = 0; i < 20; i++)
    {
    System.out.print("*");
    }
    }
    }
}

Line 66 and over is my code to print a parallelogram how do i connect this to the main method ?

Use it to replace the code that's already in main to print the parallelogram.
How much of this program did you write, and how much did you copy without really understanding it?
Your code looks like typical Java learner code, but the code in main for the parallelogram looks like it was coded by an amateur C coder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.