Hello fellow members,

I have recently started to study Java, but the lecturer went through basics very fast and now I'm having problems with starting to write a class.

I have an idea of how to write the methods, but how to declare the array properly at the start to suit this program is a mystery for me. Can somebody please explain this to me.

I basically need help with the code before the methods like size() and insertAtRank(). Any help/advise is very welcome!

I have the following assignment:

In this second part of the worksheet, you will be expected to write Java code that corresponds to the array based Vector and link based List implementation strategies discussed in the course. Much of this work will require that you transform pseudo code given in the course into Java code.

1)	ArrayVector: Create a new Java class called ArrayVector that implements the Vector interface and realises the array-based Vector implementation strategy. In accordance with previous worksheets, implement a toString() method to help you to debug / visualise the operation of the class.

The Java Vector interface and the RankOutOfBoundsException code are provided via CSI Moodle.

And the interface given is this:

 * This is the interface of the Vector ADT as is outlined in the course notes
 * @author Rem Collier
public interface Vector {
	public int size();
	public boolean isEmpty();

	public Object elemAtRank(int rank) throws RankOutOfBoundsException;
    public Object replaceAtRank(int rank, Object element) throws RankOutOfBoundsException;
    public void insertAtRank(int rank, Object element) throws RankOutOfBoundsException;
    public Object removeAtRank(int rank) throws RankOutOfBoundsException;
5 Years
Discussion Span
Last Post by stultuske

I'm not entirely sure what you are talking about. what exactly are you stuck with, what have you done so far?
as I understand it, you are having trouble to declare an array as a variable?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.