The following range-checking code works but is somewhat inefficient.Explain why and show how to revise it to be more efficient.
if (saleAmount >= 1000)
commissionRate = 0.08;
else if (saleAmount >= 500)
commissionRate = 0.06;
else if (saleAmount <= 499)
commissionRate = 0.05;
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q30: List the four keywords used in a
Q31: When the & and | operators are
Q32: When designing a flowchart for assisting in
Q33: Explain (in words) how bonuses are assigned
Q34: Why are all computer decisions true-or-false decisions?
Q35: Placing the opening brace of an if
Q36: What character(s) are used to form the
Q37: What keyword can you use to specify
Q39: In C#, what operator is used as
Q40: Describe how short-circuit evaluation works when evaluating
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents