|
-
July 27th, 2010, 10:40 AM
#2
Re: Simple GradeSystem
I didn't look at the whole thing, but let's just look at this.
Code:
if ( studentAverage > 95 ){
letterGrade == A;
}
if ( studentAverage > 85 ){
letterGrade == B;
}
if ( studentAverage > 80 ){
letterGrade == C;
}
if ( studentAverage > 75 ){
letterGrade == D;
}
if ( studentAverage < 69 ){
letterGrade == F;
}
Assume studentAverage is 96.
The first test is true, so letterGrade gets assigned A.
The second test is also true, so letterGrade no gets assigned a B, etc.
letterGrade is defined in two places, one as an int and one as a char. A, B, C, etc. aren't defined anywhere. If you mean to use them as chars, wrap them in single quotes.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|