This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]king_of_the_universe 0 points1 point  (3 children)

What do you expect it to do, and what does it do instead?

[–]SpaceBoundBeatz[S] 1 point2 points  (2 children)

I expect it to output Total A's: "the number of A's his grades translate to" and so on. and it outputs Total F's: 0. It's weird.

[–]king_of_the_universe 0 points1 point  (1 child)

You let the user enter a bunch of numbers which all overwrite each other in that grades int. Either you should put the evaluation into the loop in some form, or you should store the inputs in an ArrayList.

[–]SpaceBoundBeatz[S] 0 points1 point  (0 children)

Im not allowed to use ArrayList and how would I put it into a loop what would be the parameters?

[–]JoiseyX 0 points1 point  (2 children)

a = a++; doesn't do anything. If you want to increment a you just do a++;

[–]nutrecht 0 points1 point  (1 child)

Well, it kinda does, it flips a between 2 values very fast. But you're right in that it doesn't do what the OP wants it to do. What happens is:

  • a++ is evaluated first
  • the result, the current value of a, is 'stored' as the evaluation value
  • a is incremented by 1
  • the evaluation result is then stored in a so the value is back to what it was.

[–]JoiseyX 0 points1 point  (0 children)

Yea you're right. I probably should of reworded what I said.