mercredi 1 novembre 2017

Potential manipulation of method preference?

Novice programmer here. I know what is making my code break, I just don't why, or how to fix it. http://ift.tt/2z9yzNu

The description brief for the code clearly states we should modify the vote method as possible:

"• If the voting is complete then no further votes should be cast" Modify your vote method to apply the above rule. "

Now.

I am at a loss as to why things are going wrong.

At present, I get a NaN error, and furthermore, NO integer values are being recognised/stored for the candidate values.

If I can use a clumsy analogy; arithmetic operators (* and /) are given precedence before (+ and - ). Therefore, we use brackets to ensure that specific operators "skip the queue" so to speak. I wonder if perhaps that is where I am going here? One condition is being processed to the detriment of the remainder of the program?

Aucun commentaire:

Enregistrer un commentaire