lilrhino
04-30-2008, 11:36 PM
I've searched the world over and have not been able to find an example that addresses using a switch statement vs. if/if else statements.
This is for a homework assignment and the assigned text has one example that is not even close to assisting me with completing this assignment. Last week's assignment was to create a grade calculator using if statements. I completed that, but I can't figure out how to convert it. Please help! :(
Each grade should post to a textarea on a form. I've got the form created, but I can't get the switch statement to write to that area. I'm a novice, so I need detailed instructions please. Thanks for your response!
if (gradeOut >= 90)
gradeOut+= "My letter grade is: A";
else if (totalGrade < 90 && totalGrade >= 80)
gradeOut+= "My letter grade is: B";
else if (totalGrade < 80 && totalGrade >= 70)
gradeOut+= "My letter grade is: C";
else if (totalGrade < 70 && totalGrade >= 60)
gradeOut+= "My letter grade is: D";
else if (totalGrade < 60)
gradeOut+= "My letter grade is: F";
This is for a homework assignment and the assigned text has one example that is not even close to assisting me with completing this assignment. Last week's assignment was to create a grade calculator using if statements. I completed that, but I can't figure out how to convert it. Please help! :(
Each grade should post to a textarea on a form. I've got the form created, but I can't get the switch statement to write to that area. I'm a novice, so I need detailed instructions please. Thanks for your response!
if (gradeOut >= 90)
gradeOut+= "My letter grade is: A";
else if (totalGrade < 90 && totalGrade >= 80)
gradeOut+= "My letter grade is: B";
else if (totalGrade < 80 && totalGrade >= 70)
gradeOut+= "My letter grade is: C";
else if (totalGrade < 70 && totalGrade >= 60)
gradeOut+= "My letter grade is: D";
else if (totalGrade < 60)
gradeOut+= "My letter grade is: F";