Results 1 to 15 of 15
  1. #1
    Chinese is offline Member
    Join Date
    Dec 2015
    Posts
    5
    Rep Power
    0

    Default Can someone make a simple while loop java with this question?

    "Java program must accept an integer number from the user, the program will only end when the user inputs zero. The program must show the sum of all the input numbers at the end."

  2. #2
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    384
    Rep Power
    10

    Default Re: Can someone make a simple while loop java with this question?

    The instructions are a little unclear to me. What have you tried so far?

  3. #3
    NZelian is offline Member
    Join Date
    Mar 2016
    Posts
    6
    Rep Power
    0

    Default Re: Can someone make a simple while loop java with this question?

    Here. It uses the do-while loop.
    Last edited by Tolls; 03-07-2016 at 04:10 PM. Reason: Removed code

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Can someone make a simple while loop java with this question?

    The idea is to help folks learn, not do their work for them. In the future, please do not spoon feed solutions to posters.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    NZelian is offline Member
    Join Date
    Mar 2016
    Posts
    6
    Rep Power
    0

    Default Re: Can someone make a simple while loop java with this question?

    The idea is to help folks learn, not do their work for them.
    I understand that guiding people to reach the solution themselves is better. But I am a little offended by a part of my post having been removed like that. I had read the forum rules and I did not find anything of this kind there. So I did not violate any rules.

    You could have asked me to explain every single bit in the code I wrote, but removing it, especially when I didn't even violate any forum policies, is rude.

    About how I should write answers in the future, would it work if I did post the code but divided it into little chunks and explained what each part does? Like they explain example code in some books?

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Can someone make a simple while loop java with this question?

    It is not in the rules but it is understood by most regular posters on this forum. There is nothing wrong with providing examples of how to do certain things. If someone wanted you to explain a particular aspect of a for loop that would be fine. Or perhaps how a hash map works. But the original question was more of providing the solution to a process which looked like a homework assignment. It can be subjective but you learn to recognize it.

    As far as removing your code goes, that is typical in situations like this (and your's was certainly not the first).

    regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  7. #7
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Can someone make a simple while loop java with this question?

    Quote Originally Posted by NZelian View Post
    I understand that guiding people to reach the solution themselves is better. But I am a little offended by a part of my post having been removed like that. I had read the forum rules and I did not find anything of this kind there. So I did not violate any rules.

    You could have asked me to explain every single bit in the code I wrote, but removing it, especially when I didn't even violate any forum policies, is rude.

    About how I should write answers in the future, would it work if I did post the code but divided it into little chunks and explained what each part does? Like they explain example code in some books?
    I agree with you on the part that "spoonfeeding" is not stated in the rules. Maybe someone should add that.

    Then again, if it smells like homework, if it looks like homework, then it is homework. OP didn't bother to ask a proper question, didn't show his solution so far, he put in no effort himself. He just registered an account, posted his homework verbatim here, hoping someone would take on "the challenge" and then copy your solution as his own work. He will pass this test and do it again and again. In the end he has copy/pasted his knowledge from everywhere and nowhere. If it's your lucky day, he will get a job in CS and become your co-worker. Lucky you...

    If you search through the forum a bit, you'll find thousands of these posts. All of them are slagged off in the same way. This is not Rent-a-coder™. But you'll also find a magnitude more posts where these "newbies" post a proper question, show their effort and get limitless help from loyal members.

    I understand why it feels rude to have you post edited that way. I hope you understand the reasoning behind it.

    PS: I am not the moderator, just a regular face here at the forum.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  8. #8
    NZelian is offline Member
    Join Date
    Mar 2016
    Posts
    6
    Rep Power
    0

    Default Re: Can someone make a simple while loop java with this question?

    In the end he has copy/pasted his knowledge from everywhere and nowhere. If it's your lucky day, he will get a job in CS and become your co-worker. Lucky you...
    I beg to disagree. Nobody gets a job on the basis of copy-pasted knowledge. Besides, if they don't want to do it themselves, nobody on earth can make them do it themselves. If they don't get what they are looking for here, they'll find it somewhere else. They are not gonna do it or learn anything unless they want to learn.

    It's not that I will get brownie points for posting code here. It's just that it makes me feel good (validation, self-esteem, feeling-of-accomplishment etc. - I hope I won't be belittled for saying that), so why can't I do it sometimes? It doesn't harm anybody or anything, does it?

  9. #9
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Re: Can someone make a simple while loop java with this question?

    But the original question was more of providing the solution to a process which looked like a homework assignment.
    Does this forum have a strict policy against providing solutions to questions which are or look like homework, even if the solutions are well-explained? It will definitely help me if I could be pointed to somewhere where the purpose of this forum, as well as who this forum is for, is stated or explained. I mean, different people have different priorities; sometimes people have to take classes they are not interested in; so I am just trying to understand that is this forum only for people who are genuinely interested in learning Java, and not those who just want to get done with a little program?

    I am not trying to question how things are done here, only trying to understand that.

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Can someone make a simple while loop java with this question?

    This, as with many other forums (Code Ranch, and the Oracle forums), frowns upon providing canned solutions.
    The general approach is to get the OP to post their code and to identify the issues they are having. See post #2.

    The idea is to help people learn how to write their code, not to just give them it.
    What's the harm with giving a solution? Copy/paste is not going to stick when compared with something a bit of effort has been put into. That's number one (the old "tech to fish" rather than "give a fish"). Number two is you also take away the "eureka moment", in which the solution actually clicks for the coder.

    And yes, I swear some people I have worked with have simply copy/pasted their way through...because that's the only way they could be so clueless.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Can someone make a simple while loop java with this question?

    Quote Originally Posted by NZelian View Post
    It's just that it makes me feel good (validation, self-esteem, feeling-of-accomplishment etc. - I hope I won't be belittled for saying that)
    The important thing on this forum is helping others learn how to think through a problem and write the code. And sometimes helping includes some related examples as long as it doesn't do their work for them. Also, if you have expertise in some aspect of Java, the you can create a blog and share it. But beware! If you say something wrong or use a technique that is not considered good programming practice you will hear about it. I have been corrected a number of times on things I have provided. It just comes with the territory.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  12. #12
    NZelian is offline Member
    Join Date
    Mar 2016
    Posts
    6
    Rep Power
    0

    Default Re: Can someone make a simple while loop java with this question?

    Thank you for the reply.

    But beware! If you say something wrong or use a technique that is not considered good programming practice you will hear about it. I have been corrected a number of times on things I have provided. It just comes with the territory.
    Then that is another reason of staying here. Who wouldn't appreciate being corrected! If I write the answers in the future I will mention that I am not an expert and they shouldn't rely completely on my answers.

    I am far from being an expert. I am just a learner perhaps not too far ahead from the OP. Thing is I haven't went to school to study programming, so I haven't been exposed to that kind of practice, i.e. homework. I didn't type the code here directly. It took me some time to get it to work correctly. I enjoyed it. Whenever I ask someone to tell me how to practice they tell me to develop a complete application, but I am just learning now, I am not skilful enough to develop a complete application (even a simple one). I want this kind of questions to practice. When I post them online, it means a lot of people will get to see it, and perhaps some won't mind pointing out if it is incorrect or a part of it is wrong.

    Besides, I consume a lot of things and produce or build almost nothing. I take help from a lot of people when I don't understand anything, but I have never answered any question from anyone. I wanted to answer questions on Stackoverflow but they don't ask simple questions there. I can't decide what felt nicer, successfully writing that program or being able to answer somebody's question online. I thought it was helping me practice and helping the OP get done with something they wanted to simply get done with.

    In future, I will try my best to help the OP reach solutions themselves, rather than providing solutions.

  13. #13
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Can someone make a simple while loop java with this question?

    Quote Originally Posted by NZelian View Post
    In future, I will try my best to help the OP reach solutions themselves, rather than providing solutions.
    Excellent! And BTW, welcome to the forum.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  14. #14
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    286
    Rep Power
    6

    Default Re: Can someone make a simple while loop java with this question?

    Thank you =)

    ____________________________________

    Sorry I posted this reply in a wrong thread.
    Last edited by Zarah; 03-08-2016 at 04:03 AM.

  15. #15
    NZelian is offline Member
    Join Date
    Mar 2016
    Posts
    6
    Rep Power
    0

    Default Re: Can someone make a simple while loop java with this question?

    Excellent! And BTW, welcome to the forum.
    Thank you :)

Similar Threads

  1. Simple LOOP Question.
    By anpk05 in forum New To Java
    Replies: 14
    Last Post: 06-24-2015, 10:04 PM
  2. How do I make a simple java text game?
    By bluecloak in forum New To Java
    Replies: 7
    Last Post: 11-12-2012, 07:14 AM
  3. Replies: 2
    Last Post: 06-04-2012, 12:20 AM
  4. want to make a simple game in java
    By Tarasj in forum New To Java
    Replies: 1
    Last Post: 03-26-2012, 10:54 PM
  5. Replies: 24
    Last Post: 07-29-2008, 05:04 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
  •