Solved

Explain Why the Following Code Sample Does Not Capture the Intent

Question 23

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