OOP: Fix inheritance problems

  • 8
  • Locked
Let's investigate some body parts. First, we'll check whether bones are present. You need to fix the containsBones method and all associated logic so that, without changing the program's behavior, it returns an Object: "Yes" instead of true, and "No" instead of false.
You can't complete this task, because you're not signed in.
Comments (7)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Alex Tor
Level 27 , Bulgaria
19 May, 07:02
This is desired output: and I achieved it by changing only one line of code:
private static void printlnLivingParts() {
    System.out.println(new BodyPart("Hand").containsBones()? "Yes" : "No");
BUT, the Judge didn't accept my solution... And guess what? the only difference between mine and CG solutions is that I made only one change and it works, but the CG's solution considered there must be three changes. Fantastic 🙂
Thành Black
Level 49 , Hanoi
24 September 2021, 09:22
I can't understand
Justin Smith
Level 40 , Greenfield, USA, United States
17 August 2021, 23:04
There isn't really any inheritance correction to do in this, despite the task name. It should have been called "Replace efficient boolean logic with inefficient string-based logic".
Level 23 , Columbia, United States
8 August 2020, 00:15
Looked at the help section for this one. Had no idea at first what was needed.
yehuda b
Level 23 , Beersheba, Israel
17 June 2020, 21:01
It seems to me that the task is more about figuring out what the heck the author of the test wants from me, than "fixing inheritance problems", I still appreciate the task though, I just feel like the initial confusion I had while solving it, was unwarranted and not title of task related, but I guess it's good for your brain.
Level 25 , Richardson, United States
11 August 2019, 02:42
Can someone help pls!! , i getting correct output in Intellij, got lost no idea why its failing!!
Level 25 , Richardson, United States
11 August 2019, 03:05
Never mind, I got it. Just couple of changes!