Results 1 to 14 of 14
Thread: Upside Down Triangle
- 12-01-2011, 02:31 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Upside Down Triangle
I wrote a program that prints a triangle with smaller at top and bigger at bottom. I'm trying to do the reverse, for example:
*****
****
***
**
*
But this program just keeps spitting out **********************
What have I done wrong? It doesn't make sense because I've just reversed what I did for
*
**
***
****
*****
Java Code:import javax.swing.JOptionPane; //import JOptionPane class triangle1 { public static void main(String[] args) { String asterix = "*"; String number=JOptionPane.showInputDialog(null, "Enter triangle size:"); //Get number1 using JOptionPane int n = Integer.parseInt(number); //convert number string to n int for (int i = n; i <= n; i--) { for (int j = n; j <= i; j--) { System.out.print("*"); } // print a new line System.out.println(); } } }
- 12-01-2011, 02:57 PM #2
Senior Member
- Join Date
- Aug 2011
- Posts
- 249
- Rep Power
- 2
Re: Upside Down Triangle
Your nested loop is wrong, you put into J the N value which is wrong, you have to equal it to 0;
Java Code:for(int k=0;k<10;k++) { for(int j=0;j<=k;j++) System.out.print("*"); System.out.println(); }Last edited by tnrh1; 12-01-2011 at 02:59 PM.
- 12-01-2011, 03:09 PM #3
Re: Upside Down Triangle
Gotta love spoonfeeders...
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 12-01-2011, 03:12 PM #4
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
- 12-01-2011, 06:34 PM #5
Re: Upside Down Triangle
There's a huge difference between helping somebody and doing somebody's work for them. That's true of any field. If we're in a literature class together, it's one thing for us to discuss what we thought of the book. It's another for me to write you a summary so you don't have to read it yourself.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 12-01-2011, 10:56 PM #6
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Re: Upside Down Triangle
Big difference between literature and programming. Anybody can understand literature, some truly struggle with programming. Please refrain from attacking people who try to help in future, perhaps if we were in a manners class I could show you examples...
As before, the first person who replied is a true gem.
- 12-02-2011, 01:28 AM #7
Re: Upside Down Triangle
Anybody can understand programming, some truly struggle with literature. I for one cannot read Dickens or Shakespeare as I don't have a friggin clue what they are bangin' on about.
The reason we are so tough on those who spoonfeed is from our experience the person asking for help simply copies and pastes the spoonfed code into their program, hands it in, gets a grade they didn't deserve and still has no idea how to solve the problem. I have even seen an example where someone pasted spoonfed code into their program that was not 100% correct. Since they had no idea what the code did nor understood it they were unable to modify it and simply posted back on the forum to whine that it still didn't work. The aim of many of the more experienced people is to nudge towards finding a solution yourself and that way you are more likely to learn.
Another thing to consider is those that offer up spoonfed code have not much more experience than those asking for help. So who do you really want helping you, someone with little experience or someone with vast experience? By the way those with the more experience are less likely to help you after your little hissy fit. So you are going to be stuck with getting bad advice instead of good advice. The choice is yours.
- 12-02-2011, 01:35 AM #8
Re: Upside Down Triangle
You can only learn by doing and making the mistakes you must make.
Copying and pasting does not help a person learn.
- 12-02-2011, 10:30 AM #9
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Re: Upside Down Triangle
OK, I'll explain in the step-by-step manner that computer programmers like you seem to love as you've completely missed the point I was making. And in view of that what you have written is quite unfair and unjustified.
1. I wasn't debating the rights or wrongs of giving people direct or indirect answers.
2. I was pointing out the fact that when someone, with a kind heart, spends some of their most valuable commodity, anybody's most valuable commodity, time, to help another, this should be respected not ridiculed.
3. A remark like "gotta love spoonfeeders" is, whether it refers to something that people with experience in this field generally hold true, is crass and rude. I will cite an example of the opposite way of doing something like this further in this message.
4. Regarding the term "hissy" fit, as literature was mentioned earlier on, perhaps I could suggest you perhaps read more widely than computer manuals as no-one in an English dictionary will you find the word "hissy". It doesn't make you look very "expert" when you have to resort to frivolous terms.
5. Again referencing the "hissy" fit remark, when you have to prove your "expert" status by resorting to insults, you begin to look a little less educated than your desired status. This is lessened again when you feel the need to use offensive language such as "fr*****g".
6. Its a very safe thing to do to insult from behind a computer screen.
7. In fact I did not have said "hissy" fit. I stood by and continue to stand by what I was saying, which was not debating educational tactics in computer programming, but pointing out somebody's rudeness in attacking another who was trying to help.
8. Are you simply that arrogant that you think this is the only programming forum online? If say I wanted a quick and varied answer, do you not agree that it would be wise if I used several programming sites? So, if your "online friends" take offence to what I say and ignore me from now on how much do you think I will truly lose out?
9. Anybody with a reasonable literacy level can understand Shakespeare or Dickens. It might require more or less effort from some people, but trust me, a maths heavy subject like programming is harder for the general population. Hence why after my final assignment programming will no longer be a part of my life. With regards to literature, there are straightforward tools which you can use to help you understand, dictionaries, readers, guides etc. Unfortunately, with computer programming, what exists are "expert" textbooks, or books for beginners that are full of boring text, with very little example.
This is a very fair and reasoned way to make a point. It is also a fair way to criticise what the first person who helped me did because it is not insulting in any manner. It is succinct but could never be considered in the realms of crassness. I heavily debate the idea behind it, as if we look at how children learn from parents, generally it is by example. I agree, however, that purely copying and pasting does not help a person learn. A good student, however, seeing an example, would analyse why it works and could learn that way, much as a child studies, if a little less consciously, his/her parents' behaviour. It is rather a heavy assumption to estimate that someone would just copy and paste.
- 12-02-2011, 03:17 PM #10
Re: Upside Down Triangle
Your above message is much more rude than my off-hand remark about spoonfeeders. I didn't insult anybody, but I also didn't feel like typing out a description that the offender would likely never actually read (if you'll notice, that poster has not responded to any of this, in classic spoonfeeder style). I simply wanted to remind other posters who might think that copy-pasting a solution is how it's done that spoonfeeding is actually not helpful.
I'm as pedantic as the next programmer, but now you're just being silly- and rude.
Quite, and yet you continue to do it. You aren't going to change our opinion on spoonfeeding. You've been given the choice. It's yours to make. Continued "debate" is pointless.
You call me rude for making a single off-hand comment, and yet this entire post is you insulting the experts in this forum.
No. That's called crossposting, and nobody likes it. It's one of the easiest ways (next to throwing a continued hissy fit insulting the experienced posters here) to make sure that nobody wants to help you. You'll find that the good forums actually share many of the experienced members. You're more than welcome to find a forum with less experienced users, as you've already been told.
As I said, many of these members are on multiple forums and sites. More importantly, you've shown an attitude that will not be tolerated in any technical environment, and until you adjust it, you won't get very far in any technical field.
I believe those were just examples. The point is that different people struggle with different things. Some people find programming easier than literature. My original point was that in no field is it acceptable for you to do somebody else's work for them, especially in an academic setting.
I think that's probably a good idea. Like I said, your attitude here shows that you might not be cut out for a technical field.
I disagree. There are plenty of books out there, if you have the interest to read them. Sorry there isn't a SparkNotes on Java (actually.. http://sparkcharts.sparknotes.com/cs/java/section6.php). But like I said, some people are a better fit for programming than others. You don't seem to be a good fit, which is fine.
On what are your assumptions based? Many people here have been educating for years, so they know what they're talking about. The problem is that many students don't even know they're doing something wrong when they copy and paste code. But even if they do try to look it over, you're taking away from them the process of problem solving. That's a hard thing to teach, and the only real way to learn it is by doing it. Working through a problem, becoming frustrated, going to the tutorials, breaking things down.. all cut short by somebody who copies and pastes the solution. That person is now a weaker programmer- who is going to do better on the test, the guy who worked through his problem, consulted the tutorials, and figured it out? Or the guy who got a copy-pasted answer from a forum?
I don't like to post between forums, but I think it's warranted in this case. Read this before you post again: The Problem with Spoon-feedingHow to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 12-02-2011, 04:00 PM #11
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Re: Upside Down Triangle
At no stage have I been rude.
And cross-posting between forums? Do you truthfully think that there are that few forums out there that one forum's members and another's are the same? Or do you spend your entire life on the internet?
Going back to my FIRST and in fact ONLY point. Your first remark was rude, pure and simple, and if you can't see it as such then there are deeper issues at play than simply writing programs. But then... someone who thinks of themselves as "expert" must carry a high baggage of arrogance with them. You're not an expert, you just know a little more than other people.
And most people know programming is something that is notoriously badly taught, so perhaps the problem is that you have no idea how to become educated.
Overall, the one correct thing you said was there's no point in continuing this conversation. Indeed there isn't. Debating with someone who is so arrogant as to believe themselves beyond reproach is pointless. Though I will say, whilst I may not have the skills to cut it in programming (big deal, I do quite well for myself in another area thank-you), I believe you're showing yourself to be pretty low on social skills and completely lacking in good manners, which in the general scheme of life is not going to get you very far.
NB// You can say what you like after this, a person like you isn't worth throwing valuable time away on so I will not reply.Last edited by Interista; 12-02-2011 at 04:02 PM.
- 12-02-2011, 04:04 PM #12
Re: Upside Down Triangle
The problem with crossposting without a link to the other post is that people can spend time answering your question when it has already been answered on another forum. That wastes my time that I could have spent helping someone else.
Also when students find a topic they are interested in, the link to the other forum where there could be other approaches to solving the problem would help the student.
- 12-02-2011, 04:09 PM #13
Re: Upside Down Triangle
Your entire post is rude and insulting in a way that nobody else has been.
There are a bunch of forums. There are only a few members with experienced users. Those few forums share many of the same users. But my point was that your attitude, not us, is going to be the thing that makes it hard for you to succeed.
Not rude?
I don't think it was rude. It was certainly not nearly as rude as the comments you've made. Was it short and maybe a little snarky? Sure. But I would argue that it's ruder to spoonfeed than it is to call somebody out for doing so. Did you read the link I gave you?
At no point did I claim to be an expert, or even claim to know more than other people. Thanks for the compliment I guess. The other users here are the experts. I happen to agree with them on issues such as spoonfeeding and crossposting. Insulting them is only making you seem childish and immature.
I don't know a non-rude way to say that this is mostly nonsense, so I'm going to leave it alone.
All I did was make an off-hand remark about spoonfeeding, which I stand by. You then proceeded to become frustrated and go off on a rant about some perceived injustice, and I responded. I'm not sure what you're gleaming from that about my manners or social skills. Resorting to personal attacks shows that your actual argument doesn't have much weight. Spoonfeeding is not helping. Plain and simple.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 12-02-2011, 04:09 PM #14
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Re: Upside Down Triangle
Similar Threads
-
How to Make Upside Down Triangle Filled In?
By Settz in forum New To JavaReplies: 7Last Post: 11-21-2011, 04:42 AM -
Upside down Triangle pattern
By JayP in forum New To JavaReplies: 9Last Post: 06-06-2011, 05:46 AM -
BufferedImage flips the chart upside down
By sg3232 in forum Java 2DReplies: 0Last Post: 02-10-2011, 08:46 PM -
triangle
By Shyamz1 in forum New To JavaReplies: 4Last Post: 11-07-2010, 06:12 PM -
Triangle
By jkswebsite in forum New To JavaReplies: 8Last Post: 01-10-2009, 02:08 PM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks