Solved

Explain Why the Following Code Sample Does Not Capture the Intent

Question 22

Essay

Explain why the following code sample does not capture the intent of the request "Make sure if the sales code is not 'A' or 'B', the customer gets a 10% discount".What is the correct if statement?
if(salesCode != 'A' || salesCode != 'B')
discount = 0.10;

Correct Answer:

verifed

Verified

Whenever you use negatives, it is easy t...

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