Soft Skills
Programmers need to be able to look at alternative approaches to solving a problem and at different ways of implementing a solution, weighing the pros and cons of each. Further, they need to be able to clearly articulate to others why they recommend, or have chosen, a particular solution. Come to class prepared to discuss the following:
Sometimes either a switch statement or an if/else if statement can be used to implement logic that requires branching to different blocks of program code. But the two are not interchangeable.
A) Under what circumstances would an if/else if statement be a more appropriate choice than a switch statement?
B) Under what circumstances would a switch statement be a more appropriate choice than an if/else if statement?
C) Under what circumstances would a set of nested if/else statements be more appropriate than either of the other two structures?
Try to come up with at least one example case for each of the three, where it is the best way to implement the desired branching logic.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.