Thank you guys for responding but I sat down with a my pen and a sheet of paper and did the loop step by step and figured it out and yes I need to add comments. Its something I need to work on.
here is the code if anyone is interested on how it works..
package project.pkg5part3;
import java.util.Scanner;
public class Project5Part3
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in); // new object of scanner
//variables
int diameterOfDiamond;
String diamondCharacter;
boolean flag = true;
while(flag)
{
System.out.print("Enter the diameter of diamond: ");
diameterOfDiamond = scan.nextInt();
System.out.print("\nEnter the character to use for the drawing: ");
diamondCharacter = scan.next();
for(int i = 1; i <= (Math.ceil(diameterOfDiamond / 2.0)); i++)
{
for(int j = 1; j < (Math.ceil(diameterOfDiamond / 2.0) + 1) - i; j++)
System.out.print(" ");
for(int j = 1; j < 2 * i; j++)
System.out.print(diamondCharacter);
System.out.println();
}
for(int i = 1; i < (Math.ceil(diameterOfDiamond / 2.0) ); i++)
{
for(int j = (int) Math.ceil(diameterOfDiamond / 2.0); j > Math.ceil(diameterOfDiamond / 2.0) - i; j--)
System.out.print(" ");
for(int j = diameterOfDiamond - 2; j >= i * 2 - 1; j--)
System.out.print(diamondCharacter);
System.out.println();
}
System.out.println("Would you like to run this program again(yes/no): ");
if(scan.next().equalsIgnoreCase("no"))
flag = false;
}
}
}