Main content
Course: AP??/College Computer Science Principles?>?Unit 3
Lesson 5: ConditionalsNested conditionals
Problem
A programmer for a music company is developing a program to determine the highest level of certification for an album.
The program needs to follow this table of thresholds for each certification level:
Minimum albums sold | Certification |
---|---|
500,000 | gold |
1,000,000 | platinum |
10,000,000 | diamond |
The code segment below uses nested conditionals to assign the
certification
variable to the appropriate value, but its conditions are missing operators.certification ← "none"
IF (albumsSold <?> 10000000)
{
certification ← "diamond"
} ELSE
{
IF (albumsSold <?> 1000000)
{
certification ← "platinum"
}
ELSE {
IF (albumsSold <?> 500000)
{
certification ← "gold"
}
}
}
Which operator could replace
<?>
so that the code snippet works as expected??
Related content