It's UWAweek 24 (1st semester, 2nd exam week)

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 1 other person reading this forum.


 UWA week 21 (1st semester, week 12) ↓
SVG not supported

Login to reply

👍?
helpful
11:48am Tue 21st May, Andrew G.

ANONYMOUS wrote:

Actually sorry to make my question more brief, I just would like to ask instead of returning exception or null pointer [both of these give error] what should we do if it's out of bound from the index?

Firstly, for future reference please avoid sharing what amounts to pseudocode with other students. The project is not just assessing your ability to write Java, but your ability to design the system using the features Java provides. In this case I am not concerned, as the pseudocode you have provided is not likely to give any other students an unfair advantage.

The task you have been asked to solve has no concept of an "index", so there is no specification as to what to do with an index out of bounds. If you are using an index as part of your implementation, how to handle it being out of bounds is part of your own design.

From the information you have provided, I think your design does not solve the task as stated. To be frank, it looks logically almost identical to the (very, very wrong) solution that ChatGPT generated when I tested it. I encourage you to read the task and documentation again carefully and make sure you understand it. Make sure you understand what a double ended iterator is: It is an iterator that can consume a sequence from both ends, not one that can move a cursor back and forth. Then I suggest you construct some test cases and attempt to do them by hand yourself, as though you are the StudentListIterator. The logic required is not difficult, but I have seen a lot of students struggling because they launch straight into the code without planning out their strategy, and then find that they have not considered all the possibilities. We have a small test for it, but consider how your StudentListIterator will behave if you call next() and reverseNext() alternatingly.

Hope that helps.

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