Answer:

Yes—if the user asks for five lines, a loop should count 1, 2, 3, 4, 5.

Skeleton of Star Program

Here is the skeleton program, with the usual blanks. The program so far ignores what is to be done for each printed line of stars. It just assumes that something can be done, and focuses on getting the number of lines right.

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() ;

    
    
    while (  )    
    {

       (more statements go here )

           
    }
  }
}

Some of the information collected from the user is not used yet. First concentrate on looping the correct number of times.

QUESTION 18:

Fill in the three blanks.