please i want your help for this as fast as possible

*     
***     
*****     
***
*

Recommended Answers

All 12 Replies

Thank you pritaeas but it didn't help me I wont it just like this

*
***
*****
***
*

and I don't know how
thank you

What have you tried? Where's your code at?

Have you written pseudocode yet? - Start with that if you're lost.

Have you treid to implmeent it yet? If so, then show us the code, and tell us what you don't understand?

it's your homework, you're obviously too lazy to even look at some of the millions of examples implementing it strewn around the internet so why should we bother even trying to help you?

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

It's a pretty complex program.

sounds like a genuine Java teacher allright ....

Mussdroid: a few remarks:

don't just send links with ready made code (especially if they
a. don't do what the OP ask
b. contain basic flaws, like by default having the main method throw an Exception)

it's nice that the video contained some explanation, but since the movie is not doing what the op is trying to do ...

give the OP some time to (at least) try himself. just handing code won't learn him anything, it just might get him kicked from his class for plagiarism.

hmm, sending unrepentent homework kiddos on tracks that leads them to failure is exactly what we should do.
Might teach them a lesson...

1st:
I am not in school or college I love computer and programing and wont to learn java
I started from websites and some books.
2nd:
I found this question in abook and I try to do it but didn't so I asked you to help me to do it and understand it

public class MM {
public static void main(String[] args) {
simpleDrawing(4);
}
public static void simpleDrawing(int number) {
for(int i = 1; i <= number; i++) {
for(int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();   
}
for(int x = 1; x <= (number+1) ; x++) {
System.out.print("*");
}
System.out.println();   
for(int v = number; v >= 1; v--) {
for(int q = 1; q <= v; q++) {
System.out.print("*");
}
System.out.println();   
}   
}
}

this is the code that I write but the output is:

*
**
***
****
*****
****
***
**
*

and I wont it like this:

*
***
*****
***
*

Your code increases the number of asterisks by one on each pass of the loop because you are using ++ to add one to the variables that control the number of asterisks each time (-- for the second half)..
You need to add 2 to the right variables each time (subtract 2 for the second half.

Thank you JamesCherrill I understand it and it's work
thank you again for your help

another way to get that, is to check whether or not i is an odd or even number (using the % operator), only print when i is odd.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.