Discuss the problems of programming with switch logic. Explain why polymorphism can be an effective alternative to using switch logic.
Fill in the blank(s) with the appropriate word(s).
The main problems with programming using switch logic are extensibility and program maintainability. A program containing many switch statements is difficult to modify. A programmer will need to add or remove cases from many, possibly all, switch statements in the program as the types of objects in the program change. The polymorphic approach eliminates these issues, as new types can be added to a program with relative ease. Only the part of the program that creates objects needs to be aware of the newly added types. [Note: switch logic includes if...else statements, which are more flexible than the switch statement.]
You might also like to view...
In addition to writing your own formulas, you can use predefined formulas called ____________________.
Fill in the blank(s) with the appropriate word(s).
The reverse method is defined in this section. What is list1 after executing the following statements?
``` int[] list1 = {1, 2, 3, 4, 5, 6}; int[] list2 = reverse(list1); ``` a. list1 is 1 2 3 4 5 6 b. list1 is 6 5 4 3 2 1 c. list1 is 0 0 0 0 0 0 d. list1 is 6 6 6 6 6 6
Illustrator identifies a compound path as a(n) single object.
Answer the following statement true (T) or false (F)
You should use the _____ method to test whether each item in an array matches a specified condition.
A. apply() B. every() C. call() D. shuffle()