> PLEASE! I need help on how to write this JAVA program.?

PLEASE! I need help on how to write this JAVA program.?

Posted at: 2014-12-18 
import java.util.Scanner;



public class Square {



public static void main(String[] args) {



Scanner sc = new Scanner(System.in);



System.out.print("Enter Integer: ");

int size = sc.nextInt();

for(int i=1;i<=size;i++){

for(int j=1;j<=size;j++){

System.out.print("X");

}

System.out.println();

}

}

}

import java.util.Scanner;

public class xsquare

{

public static void main(String args[])

{

System.out.println("Enter a positive integer no greater than 15:");

Scanner in = new Scanner(System.in);

int num = in.nextInt();

while(num < 1 || num > 15)

{

System.out.println("Incorrect input. Enter a positive integer no greater than 15:");

num = in.nextInt();

}

for(int i = 1; i <= num; i++)

{

for(int j = 1; j <= num; j++)

{

System.out.print("X");

}

System.out.println();

}

}

}

This is an exercise using nested "for" loops.

pseudocode:

input n

for i is 1 to n

for j is 1 to n

print "X"

end for j

print new line

end for i

Write a program that asks the user for a positive integer no greater than 15. The program should then display a square using the character 'X'. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following:

XXXXX

XXXXX

XXXXX

XXXXX

XXXXX

If the user enters 8, the program should display the following:

XXXXXXXX

XXXXXXXX

XXXXXXXX

XXXXXXXX

XXXXXXXX

XXXXXXXX

XXXXXXXX

XXXXXXXX