Solved

The Following Range-Checking Code Works but Is Somewhat Inefficient

Question 38

Essay

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:

verifed

Verified

This version of the code works, but it i...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents