Java Program Create a version of the stars program to print a configuration of t
ID: 672552 • Letter: J
Question
Java Program
Create a version of the stars program to print a configuration of the stars just like in the picture. I am not sure of my loop knowledge and its getting some interesting errors. Thanks for any helpful insight.
*Demonstrates the use of nested for loops. eauthor Java F public class Stars * Prints a triangle shape using asterisk (star) characters. param args public static void main (String[] args) final int MAX-ROWS = 10; for (int row= MAX ROWS; row > 0 ; row--) for (int star = 0; starExplanation / Answer
public class Stars
{
/**
* Prints a triangle shape using asterisk (star) characters.
* @param args
*/
public static void main (String[] args)
{
final int MAX_ROWS = 10;
for (int row = 1; row <= MAX_ROWS ; row++)
{
//spaces needs to inserted
for(int space = 0 ; space < MAX_ROWS - row ; space++)
System.out.print(" ");
for (int star = 0; star < row; star++)
System.out.print ("*");
System.out.println();
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.