It's UWAweek 26 (mid-year break)

help2005

This forum is provided to promote discussion amongst students enrolled in CITS2005 Object Oriented Programming.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 257 articles.
Currently 11 other people reading this forum.


 UWA week 20 (1st semester, week 11) ↓
SVG not supported

Login to reply

👍?
helpful
1:57pm Wed 15th May, Andrew G.

"William Rayner" [email protected] wrote:

I thought it was for the initial call to hasNext()

You are correct. I have hidden the original post as I think the wording was potentially misleading.

The statement I will make is as follows:

The testFilter() test is correct as written.

Note that the first call to stats.expect(count, countit.getCount(), ...) occurs after the first call to hasNext().

Consider the question: How can the filtered iterator know if it has a next element without testing the element using the predicate?

As has been mentioned in a previous post, the tests (and this test in particular) are not as strict as they could be. By the specification, your filtered iterator should not consume any elements from the given iterator except as required. But this test does not check the consumed count until after the first call to hasNext(). It is therefore possible to pass this test without quite perfectly implementing the specification. I encourage everyone to read the marking rubric carefully, but put simply: If you pass the test you get the mark (even if the test is more forgiving than the specification). Indeed, some later tests explicitly have a margin for error built i n.

I hope that clarifies this matter.

Gozz

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy