Can you show me how to fill in the provided slots so the resulting code fragment
ID: 3661337 • Letter: C
Question
Can you show me how to fill in the provided slots so the resulting code fragment satisfies the given requirement(s). Note: you may leave any particular slot empty-if it leaves legal java code. You may also add more statements; However you can NOT change or delete any of the given code.
Requirments: print the following specific pattern to the output console.
//Start
*****
**** //These astrics start under the third astric above. So if it is displaying properly there are 2 astrics above
*** // each line of astrics, which have no astrics underneath them. When I post it is deleting my spacing.
**
*
for (int k = _____; _____; ______)
{
_____________________________________
for (int j=_____; _____; ______)
{
System.out.print ('*');
______________________________________
}
_________________________________________
}//End
Explanation / Answer
Solution
for loop requires
for(k=any value;k=<1;k--)
1st blank ::
k must be intialize with some value;
2nd blank ::
k must check some condition;
3rd blank ::
k must be incremented or decremented
after that inside the for loop.
There must be block of code.
If there is nothing to write put ;
as a null statement
for loop requires
for(k=any value;k=>1;k--)
For 2nd for loop
f
1st blank :: j must be intialize with some value;
2nd blank :: j must check some condition;
3rd blank :: j must be incremented or decremented
After that we are printing the *
after that you can put a block of code
;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.