0%
0 / 15 answered
Nested Conditionals Practice Test
•15 QuestionsQuestion
1 / 15
Q1
Given this shopping-cart pseudo-code, what will the discount be if isMember=false, total=160, isSeasonSale=true?
// Inputs: isMember, total, isSeasonSale
IF isMember
IF total >= 100
IF isSeasonSale
discount = 0.20
ELSE
discount = 0.10
ELSE
discount = 0.05
ELSE
IF isSeasonSale AND total >= 150
discount = 0.15
ELSE
discount = 0.00
Given this shopping-cart pseudo-code, what will the discount be if isMember=false, total=160, isSeasonSale=true?
// Inputs: isMember, total, isSeasonSale
IF isMember
IF total >= 100
IF isSeasonSale
discount = 0.20
ELSE
discount = 0.10
ELSE
discount = 0.05
ELSE
IF isSeasonSale AND total >= 150
discount = 0.15
ELSE
discount = 0.00