The world of shapes is much richer than the shapes included in the inheritance hierarchy . Write down all the shapes you can think of—both two-dimensional and three-dimensional—and form them into a more complete Shape hierarchy with as many levels as possible. Your hierarchy should have the base-class Shape from which class TwoDimensionalShape and class ThreeDimensionalShape are derived. [Note: You do not need to write any codefor this exercise.] We’ll use this hierarchy to process a set of distinct shapes as objects of base-class Shape. (This technique, called polymorphism)

What will be an ideal response?


Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. There is no problem with these two function definitions: 2. There is no problem with the compiler distinguishing these two function definitions: 3. The compiler ha no problem distinguishing these two function definitions: 4. Mixing call-by-reference and call-by-value parameters is strictly prohibited. 5.Default arguments can be used with either call-by-value or call-by-reference parameters.

Computer Science & Information Technology

How does the environment handle a breakpoint when the debugger is running a program?

A. Stops the program at the line that has the breakpoint but doesn’t execute it. B. Stops the program at the line of the breakpoint after it has executed it. C. Runs past the line with the breakpoint but echoes the valuesin the Trace window. D. Shows the call stack in the memory window.

Computer Science & Information Technology

Assume int[] scores = {1, 20, 30, 40, 50}, what is the output of System.out.println(java.util.Arrays.toString(scores))?

a. {1, 20, 30, 40, 50} b. [1, 20, 30, 40, 50] c. {1 20 30 40 50} d. [1 20 30 40 50]

Computer Science & Information Technology

Which of the following algorithms performs better in typical situations (sparse graphs)?

a. Kruskal's algorithm b. Prim's algorithm c. BFS d. DFS

Computer Science & Information Technology