Re: asterisk forming diamond
Take a look at the similar threads listed at the bottom.
http://www.javaprogrammingforums.com...-triangle.html
Does this help? This question has been answered quite a few times recently.
P.S - Please dont post the same thread twice.
Re: asterisk forming diamond
What's "Object Oriented Programming" about a class that does everything in its main(...) method?
db
Re: asterisk forming diamond
Quote:
Originally Posted by
Darryl.Burke
What's "Object Oriented Programming" about a class that does everything in its main(...) method?
db
Thats how students are taught when they first learn JAVA. Usually when they are learning the basic syntax and the teacher/professor doesn't want to go indepth with the whole Object Oriented side of it.
"The system" is messed up for sure. I disagree with how JAVA is taught, getting students to create classes that are exact copies of JAVA Provided classes (like we see a lot on this forum) defeats the purpose of JAVA. As does handcuffing the students when they are trying more complex algorithms. The stupidest thing of all is that my college won't let me take the beginners JAVA class until I finish C. I've asked about testing out, but they said if I tested out I don't get the credit for the course...
Re: asterisk forming diamond
..the output should look like this
*
* *
* * *
* *
*
..but then the output of this program is
*
* *
* * *
* * *
* *
*
..sorry this should be in loops..thank you..pleas help me..
Re: asterisk forming diamond
Re: asterisk forming diamond
Quote:
Originally Posted by
aussiemcgr
Thats how students are taught when they first learn JAVA. Usually when they are learning the basic syntax and the teacher/professor doesn't want to go indepth with the whole Object Oriented side of it.
"The system" is messed up for sure. I disagree with how JAVA is taught, getting students to create classes that are exact copies of JAVA Provided classes (like we see a lot on this forum) defeats the purpose of JAVA. As does handcuffing the students when they are trying more complex algorithms. The stupidest thing of all is that my college won't let me take the beginners JAVA class until I finish C. I've asked about testing out, but they said if I tested out I don't get the credit for the course...
I think a student needs to understand the basics before getting into the Object Oriented philosophy. For simple programs, it's much easier for new students to learn imperative programming before starting to worry about functional or Object Oriented programming. Granted, the amount of time being spent on imperative programming may be a bit excessive depending on who your professor is.
I disagree that it defeats the purpose of Java to have students write classes which are already implemented in Java, I think a computer scientist should understand how the tools they are using work. While implementing your own sorting algorithm every single time may not be practical, knowing these basic algorithms will help you develop larger algorithms and systems which perform much better than a simple "intuitive" solution.
Anyways, back on topic :P
The reason you're diamond is drawing three stars in the middle is because you're starting to draw stars before you decrement to 2 (to take into account that 3 stars have already been drawn by the first loop).
Try running your code as if you were the computer (get a piece of scratch paper to keep track of the output and variable values).