CONDITIONS
You are eligible to vote.
Grade: B
You have access to most features.
If...Else Condition for Voting Eligibility
In this example, we check a person's age to determine voting eligiblity.
- If the age is 18 or older, it prints that the person is eligible to
vote.
- If the age is below 18, it prints that the person is not eligible to
vote.
If...ElseIf...Else Condition for Grades
In this example, we evaluate a score and determine the corresponding
letter grade based on a defined grading scale. This matches the INFOST
440 Syllabus grading scale. I am personally hoping to end above
a 94!
- Scores 94 and above receive an "A".
- Scores between 90 and 93.99 receive an "A-".
- Scores between 87 and 89.99 receive a "B+".
- Scores between 84 and 86.99 receive a "B".
- Scores between 80 and 83.99 receive a "B-".
- Scores between 77 and 79.99 receive a "C+".
- Scores between 74 and 76.99 receive a "C".
- Scores between 70 and 73.99 receive a "C-".
- Scores between 67 and 69.99 receive a "D+".
- Scores between 64 and 66.99 receive a "D".
- Scores between 60 and 63.99 receive a "D-".
- Scores below 60 receive an "F".
Switch/Case Statement
The switch statement evaluates a variable and executes
code based on its value. Depending on whether platinum, gold,
silver, or no membership, it displayed the appropriate message. In this
case, it displayed access to most features for gold membership.