Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help With Flowchart (Non-Code Issue)

  1. #1
    Junior Member
    Join Date
    Sep 2013
    My Mood
    Thanked 0 Times in 0 Posts

    Default Help With Flowchart (Non-Code Issue)

    Hello everyone and Good Morning! In learning about Counters and Accumulators, I have been given the task to create a flowchart that does the following:

    "Ask the user for a positive, whole number > 0, call it x. Output all the numbers from 1 up to x."

    I have a few flowcharts written out that don't quite do what I want them to do when I desk-check them. I could use a little help/ a nudge in the right direction (As this forum is filled with people who tend to do just that, and only that *no offense*)

    A flowchart I have created goes as follows in descending order:

    (Counter) outX = outX + 0
    Output - "Enter positive whole number"
    Input - x

    Decision (outX = x)?

    -No- (x = x -1) (outX = outX + 1) >>>>>>>> Output " outX " >>>> Loop back to decision

    -Yes- Output "outX, x"


    I know this is very basic and I am missing something, but I don't quite know what. Any help or advice would be greatly appreciated.

  2. #2
    Forum VIP
    Join Date
    Jul 2010
    Thanked 329 Times in 305 Posts

    Default Re: Help With Flowchart (Non-Code Issue)

    A few questions:
    1. Why have you initialized your counter to outX + 0? Why not just 0?
    2. I don't know if it would be part of your requirements, but in a real-life situation, you would want to varify that the user did in fact give you a number > 0. Just because you tell a user to do something, doesn't mean they actually will.
    3. Why are you decrementing x in your loop? If you subtract x by 1 and add outX by 1, you are technically advancing the counter by 2 since you do an equals check with outX and x (and, if x is odd, you will pass right by the value since they will never equal each other).

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. issue with jsp code
    By zulu1900 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 20th, 2013, 01:08 PM
  2. Issue in a code
    By ayyappad in forum What's Wrong With My Code?
    Replies: 6
    Last Post: August 3rd, 2013, 07:17 PM
  3. Need help with flowchart
    By Unknown3344 in forum Java Theory & Questions
    Replies: 0
    Last Post: November 23rd, 2012, 07:42 AM
  4. I am having an issue with my code
    By gmamagoodwin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 9th, 2012, 11:36 PM
  5. code issue, should be silple been working on it for four hours
    By Custermd in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 30th, 2011, 01:19 PM