The program, with a correct outer loop, is below.
If ( more stuff goes here ) somehow
printed a row of numStars stars,
the program would be finished.
import java.util.Scanner;
//
class starBlock
{
public static void main (String[] args )
{
Scanner scan = new Scanner( System.in );
int numRows; // the number of Rows
int numStars; // the number of stars per row
int row; // current row number
// collect input data from user
System.out.print( "How many Rows? " );
numRows = scan.nextInt() ;
System.out.print( "How many Stars per Row? " );
numStars = scan.nextInt() ;
row = 1;
while ( row <= numRows )
{
( more stuff goes here )
System.out.println();
row = row + 1;
}
}
}
Now you must perform one of the most important tasks in computer programming: ignoring the big problem and looking at a little problem.
Clear you mind of all thoughts about the big program.
Just think about the little problem.
How would you print a row of numStars stars, one star at a time?