This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This is my first post. I have limited experience in MATLAB and have taken on a Java subject for uni. I have a non graded task for uni in which there is an additional component for those wishing to challenge themselves. After a week I realise I need help.
The practical code will expand over the next few practicals so that it holds a 2D raster surface as values in an array of arrays (2D array). However, we could instead store the x/y coordinates and attributes of vector points in our array. Try taking a copy of this week practical and adapting it so that rather than storing an array of doubles, it stores an array of Point objects, each containing an x and y value. Try setting and getting back a couple of x values from within the array. (Make sure you take a copy of your practical code, as we'll work with the double-array version next week). You'll need to make a third 'Point' class, as we saw in the lecture." It is from the University of Leeds if you want to confirm that it isn't an assignment.
I have tried extending it further to make the coordinates random and am having problems. Storage.java holds the data. Point.java allows the stored data to be represented as coordinate pairs. I am having problem running it. Any direction or guidance would be greatly appreciated.
I originally made the code successfully by originally defining the array values using the method shown immediately below (in the Storage.java file).
My final (yet erroneous) code has tried to replace this manual use of defining values in a loop where each coordinate for the respective [x,y] position in the array is a random number. It is presented below. The ERROR encountered states that in the Analyst.class the variables i and j can not be found, however they are present in the for loop, no? The process has worked for me in more simple code in the past.