You're welcome.
Get a good sleep and try again tomorrow.
Type: Posts; User: Norm
You're welcome.
Get a good sleep and try again tomorrow.
Come on back when you have had time to write the code.
See post#42 It has as simple a suggestion as I can make.
Your code shown in the first post does it.
I guess you should give up for now and try later.
Try a very simple exercise:
Write a loop to print x number of "*" on a line.
If x is 0 you print none,
if x is 1 you print 1
if x is 2 you print 2
etc
There are no true or false statements in this problem. It is done with loops and math.
Try it and see what happens.
What is it you want those two statements to do?
Can they be merged into a single statement?
Now add code to print out the next lines: 2 to 5.
You need a loop for the spaces and a loop for the *s
Ok. Thats a start. You've printed the first line with some spaces and some *s
Now add code to print out the next lines.
You need a loop for the spaces and a loop for the *s
Can you explain why...
There is no boolean variable involved in this logic. It is only loops and math.
Compile and execute it and see what is printed.
What have you tried? Post your code that shows the problem.
What happens when you compile and execute your code?
y is an integer, like 4. If you print 4 *s the printout would be: ****
You already have the code for that in your first two programs.
First do the steps I asked you to do in post#17
What do you need to print for the first line? Some spaces and some *s.
Two parts:
One print x spaces: what is the code for that?
Two print y *s:...
No. x and y are numbers. like 4 and 1 then 3 and 2 etc
Answer me this question: Do you want to learn programming?
If so, you'll need to learn to think like a computer operates.
Do the project a small bit at a time.
Write down on paper the steps to print out the first line. See post #10.
What do you need to print for the first line? Some spaces and some *s.
Two parts:...
System.out.print(" "); // prints a single/empty space
Look at the code you posted already. It prints a different number of *s on each line. Hint: it takes a loop
Part of your problem could be using the wrong variable names and no comments.
Here is the second assignment with comments and new names:
int nbrRows=5;
// Print on nbrRows
...
Have you looked at the problem of what is being printed line by line?
What goes on the first line? Some spaces and some *s
What goes on the second line? A different number of spaces and *s
How...
What work have you done on the problem?
Have you solved it now? Your post doesn't really say?
Draw the designs you want to print, look at where the spaces are and where the *s are.
Design code that will output the required number of spaces and the number of *s on each line.
Your current...