What is the problem with the following algorithm? 1. enter the code and sales am
ID: 3659089 • Letter: W
Question
What is the problem with the following algorithm? 1. enter the code and sales amount 2. calculate the bonus amount by multiplying the sales amount by .08 3. if (the code is X) if (the sales are greater than or equal to 10000) add 150 to the bonus amount else if (the sales are less than 10000) add 125 to the bonus amount end if end if end if 4. display the bonus amount Choose one answer. a. It includes an unnecessary nested selection structure. b. The primary and secondary decisions are reversed. c. It uses a logical operator when a nested selection structure should be used. d. There is no problem with the algorithm.Explanation / Answer
1. enter the code and sales amount 2. calculate the bonus amount by multiplying the sales amount by .08 3. if (the code is X) if (the sales are greater than or equal to 10000) add 150 to the bonus amount else if (the sales are less than 10000) add 125 to the bonus amount end if end if end if 4. display the bonus amount Choose one answer. problem: there is no need for the else if, it should be an else statement a.It includes an unnecessary nested selection structure.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.