Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. OOP: Fix inheritance problems
  2. Correct the containsBones method and all associated logic so that:
  3. 1. The program's behavior remains the same.
  4. 2. The containsBones method must return an Object and the value "Yes" instead of true, and "No" instead of false
  5.  
  6.  
  7. Requirements:
  8. 1. The BodyPart class's containsBones method must return an Object.
  9. 2. The Finger class must be a descendant of the BodyPart class.
  10. 3. The Finger class's containsBones method must return an Object.
  11. 4. The BodyPart class's containsBones method should return "Yes".
  12. 5. The Finger class's containsBones method should return "Yes" if the BodyPart class's containsBones method returns "Yes" and the isArtificial flag is false. If this condition is not satisfied, then return "No".
  13. 6. The BodyPart class's toString method should return a string formatted as follows "<name> (name of the body part) contains bones" if the containsBones method returns "Yes" for the body part. If it returns "No", then the string should be formatted as "<name> (name of the body part) does not contain bones".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement