CMSC 335 CMSC335 Homework 1 Answer (UMUC)

CMSC 335 CMSC335 Homework 1 Answer (UMUC)

soffix

  • $14.99


CMSC 335 Homework 1 Answer / Object-Oriented and Concurrent Programming

For problems 1 through 4, explain why the code as shown is almost certainly not what the programmer intended, and how it should be fixed to work the way the programmer probably had in mind.

1. (10 pts) What is wrong with the following program and how should it be fixed?

2. (10 pts) What is wrong with the following program and how should it be fixed?

3. (10 pts) What is wrong with the following program and how should it be fixed?

4. (10 pts) What is wrong with the following program and how should it be fixed?

5. (10 pts) Given all the problems identified in problems 1 through 4, explain in detail why the following code works, ie, compiles without errors or warnings.

6. (10 pts) Explain why the following class hierarchy is not reasonable:

7. (10 pts) Give at least one example of a reasonable field for each of the following classes in the following class hierarchy. Be sure that the field is at the right level in the hierarchy.

8. (10 pts) Give at least one example of a reasonable method for each of the following classes in the following class hierarchy. Be sure that the method  is at the right level in the hierarchy. Constructors, getters and setters don't count for this problem.

9. (10 pts) Are a Private and a Platoon in an encapsulation or an inheritance relationship? Explain

10. (10 pts) Present reasonable parent and child classes for the class Tree (the biological kind). Give a short explanation for why the classes you are proposing are in good parent-child relationships.


We Also Recommend


Sale

Unavailable

Sold Out