what bugs can you find in this pseudocode?


5 Responses to “what bugs can you find in this pseudocode?”

  1. Quantum Incarnation says:

    you need an if/then test to handle error messages.

  2. jmart says:

    Loops appear solid, you might want to assign 1 to monthCounter just outside your nested loop, and 1 to yearCounter just outside your main loop.

    Don’t forget to initialize your variables and that should do the trick.

    Hope this helps,
    -John

  3. Peter K says:

    What sort of pseudocode is this?

    1) yearCounter and monthCounter are not initialised before their loops.
    2) Why write 30 YEARS and 12 MONTHS. Don’t write the numbers into the loop limits.
    3) Where did month number and year number get declared let alone initialised.
    4) Isn’t month number the same as monthCounter?
    5) How do you set the initial year number?
    6) Coupons can only start in January and end in December?

  4. Inetdog says:

    A few stand out, but this is probably not a complete list:
    1. If MONTHS is set to 12 and YEARS is set to 30, then the while tests will not have the intended result. Depending on the syntax of the pseudocode they might be undefined or equal to 30 times 30 and 12 times 12.
    2. yearCounter should be incremented in the outside loop, not the inside loop and the first endwhile should come between the month increment and the year increment.
    3. Again depending on the syntax of your pseudocode, the index variables yearCounter and monthCounter may not start out intialized to zero or any other predictable value. And if it does start at zero, you will get 13 months time 31 years using the less than or equal to test.

  5. dhvrm says:

    printCoupons ()
    const num MONTHS = 12
    const num YEARS = 30
    num monthCounter = 1
    num yearCounter = 1
    while yearCounter <= YEARS
    while monthCounter <= MONTHS
    print month number, year number, “Remember to send your payment by the 10th”
    yearCounter = yearCounter + 1
    monthCounter = monthCounter + 1
    endwhile
    endwhile
    return

Leave a Reply

*


Celebrity Sex Tapes | Kim Kardashian Sex Tape