I have the exact same issue. I think the answer to 3e) should be 4, but I got it wrong and for 1a) I clearly stated the error and provided the fix, but still lost a mark. I'd like to see the solutions please.
I've already spoken to him about the issue with question one. He will most likely make the test 18/19 if it's okay with the other prof.
For 3e, I think you both made the same mistake... It would be a error Client.java:8: g(double) in Parent cannot be applied to (int,double) p2.g(5,5.5); ^ 1 error
Thanks for the clarification. I think I know why I thought it was going to be 4 instead of an error.
I imagined that Java remembers that p2 started out as a child and would therefore call the child's method thereby resulting in 4. However, I forgot that the method must exist in Parent at least as an abstract method, which in this case it does not.
For test 2, should the answer question 3e) be 4, because of method g(int, double) is an overloading method. I think It was marked incorrectly. Thanks.
ReplyDeleteFor test 2 question 1a, I wrote MyClassB didn't implement the method intAMethod(); and I losted a mark for that. Why is that?
ReplyDeleteI have the exact same issue. I think the answer to 3e) should be 4, but I got it wrong and for 1a) I clearly stated the error and provided the fix, but still lost a mark. I'd like to see the solutions please.
ReplyDeleteThank you
I've already spoken to him about the issue with question one. He will most likely make the test 18/19 if it's okay with the other prof.
ReplyDeleteFor 3e, I think you both made the same mistake...
It would be a error
Client.java:8: g(double) in Parent cannot be applied to (int,double)
p2.g(5,5.5);
^
1 error
Because the Parent g method asks for double x
-Y
Sorry, that didn't make much sense. Instead of 18/19, it should just be out of 19.*
ReplyDeleteThanks for the clarification. I think I know why I thought it was going to be 4 instead of an error.
ReplyDeleteI imagined that Java remembers that p2 started out as a child and would therefore call the child's method thereby resulting in 4. However, I forgot that the method must exist in Parent at least as an abstract method, which in this case it does not.
You're welcome, buddy. :)
ReplyDelete- Y
wen will lab 8 be posted?
ReplyDeleteI got that now. Thanks
ReplyDelete