Okay Im a newbie and Im working on a program that allows the user to enter a grade (0-100) and then the console returns to the user the grade and the letter of the grade. This is what i have and so far I have only programmed grades 70 and up. Here's my problem: if the grade is 90 or above, the console displays "A".. which is fine. But when I enter a grade that is less than 90 and above 80, the console displays "AB".. then when I enter a grade above 70 and less than 80 the console displays "ABC".. this program is supposed to return grades, not teach me my ABCs. Please help and let me know if I am approaching this program completely wrong. Here's what I got:
Replace if (grade >= 90, grade < 100)
with if (grade >= 90 && grade < 100)
The comma gets you to do two seperate operations. It doesn't replace the AND operator.
Note: if (B = true) is probably not doing what you think it is doing. it is setting B equal to true (not comparing) and then returning that value (which is true).
Note 2:
Why would you set B = true; then if (B == true)? It seems unnessesary since the only times that you'll enter the for loop is if the line in front of it is called which always happens.