Results 1 to 14 of 14
Like Tree3Likes
  • 3 Post By Junky

Thread: Upside Down Triangle

  1. #1
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default 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();
       }
    }
    }

  2. #2
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default 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.

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default 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!

  4. #4
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default Re: Upside Down Triangle

    Quote Originally Posted by KevinWorkman View Post
    Gotta love spoonfeeders...
    I don't understand attitudes like yours. If someone tries to help why should they be put down? Computing is the ONLY area in which I have ever come across a negative attitude towards helping people.

    Thanks tnrh1!

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default Re: Upside Down Triangle

    Quote Originally Posted by Interista View Post
    I don't understand attitudes like yours. If someone tries to help why should they be put down? Computing is the ONLY area in which I have ever come across a negative attitude towards helping people.

    Thanks tnrh1!
    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!

  6. #6
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default 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.

  7. #7
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,782
    Rep Power
    7

    Default Re: Upside Down Triangle

    Quote Originally Posted by Interista View Post
    Anybody can understand literature, some truly struggle with programming.
    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.
    Norm, JosAH and KevinWorkman like this.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default 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.

  9. #9
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default Re: Upside Down Triangle

    Quote Originally Posted by Junky View Post
    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.
    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.

    Quote Originally Posted by Norm View Post
    You can only learn by doing and making the mistakes you must make.
    Copying and pasting does not help a person learn.
    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.

  10. #10
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default Re: Upside Down Triangle

    Quote Originally Posted by Interista View Post
    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.
    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.


    Quote Originally Posted by Interista View Post
    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".
    I'm as pedantic as the next programmer, but now you're just being silly- and rude.

    Quote Originally Posted by Interista View Post
    Its a very safe thing to do to insult from behind a computer screen.
    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.

    Quote Originally Posted by Interista View Post
    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.
    You call me rude for making a single off-hand comment, and yet this entire post is you insulting the experts in this forum.

    Quote Originally Posted by Interista View Post
    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?
    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.

    Quote Originally Posted by Interista View Post
    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?
    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.

    Quote Originally Posted by Interista View Post
    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.
    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.

    Quote Originally Posted by Interista View Post
    Hence why after my final assignment programming will no longer be a part of my life.
    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.

    Quote Originally Posted by Interista View Post
    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.
    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.



    Quote Originally Posted by Interista View Post
    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.
    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-feeding
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  11. #11
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default 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. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default 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.

  13. #13
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default Re: Upside Down Triangle

    Quote Originally Posted by Interista View Post
    At no stage have I been rude.
    Your entire post is rude and insulting in a way that nobody else has been.

    Quote Originally Posted by Interista View Post
    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?
    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.

    Quote Originally Posted by Interista View Post
    Or do you spend your entire life on the internet?
    Not rude?

    Quote Originally Posted by Interista View Post
    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.
    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?

    Quote Originally Posted by Interista View Post
    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.
    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.

    Quote Originally Posted by Interista View Post
    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.
    I don't know a non-rude way to say that this is mostly nonsense, so I'm going to leave it alone.

    Quote Originally Posted by Interista View Post
    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 hae the skills to cut it in programming, 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.
    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!

  14. #14
    Interista is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default Re: Upside Down Triangle

    Quote Originally Posted by Norm View Post
    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.
    Understood and taken on board. The only issue between doing this for example here, and other forums I use would be that many of the other forums I use are in different languages (real languages, not code, hence why I didn't believe cross-posting would be an issue).

Similar Threads

  1. How to Make Upside Down Triangle Filled In?
    By Settz in forum New To Java
    Replies: 7
    Last Post: 11-21-2011, 04:42 AM
  2. Upside down Triangle pattern
    By JayP in forum New To Java
    Replies: 9
    Last Post: 06-06-2011, 05:46 AM
  3. BufferedImage flips the chart upside down
    By sg3232 in forum Java 2D
    Replies: 0
    Last Post: 02-10-2011, 08:46 PM
  4. triangle
    By Shyamz1 in forum New To Java
    Replies: 4
    Last Post: 11-07-2010, 06:12 PM
  5. Triangle
    By jkswebsite in forum New To Java
    Replies: 8
    Last Post: 01-10-2009, 02:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •