• Post Reply Bookmark Topic Watch Topic
  • New Topic

One last question!!  RSS feed

 
Sarah Bushnell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do!

You lot have been such a great help... So far I've done all but one thing in my assignment. I've managed to store student Id's, marks and grades in a two-dimensional array (which Im please with because, well, I've only been studying Java for 8 weeks) but the final section requires creating an index to the table to enable a sort of the marks to take place. So far, no-one I have spoken to on my course knows what this means, and the lecturer won't tell us as it's for our assignment, which sucks.

We were given this example, pertianing to the diagram of a table we have:_

names[empNoIndex[0]]
payrollData[empNoIndex[0]][0]
payrollData[empNoIndex[0]][1]
payrollData[empNoIndex[0]][2]

I understand what this represents, but how the hell do I sort using that example?

SO CONFUSED!!!

Please help!!

 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example you were given doesn't give us much faith in your instructor
as an object-oriented programmer -- names in one array, and a grid of marks
in another array. Hurmph! Most Java programmers would have defined a
class to refer to a student and their marks. Then one could then
go on to discuss about how to organize collections of these objects and how
to compare and sort them. But your instructor's example quashes that.
(It looks like your instructor is more of a database person.)
Instead, you need to concentrate on the int[] empNoIndex. Do you
see that empNoIndex[0] is the offset in your other arrays of the "first"
student and his/her marks. Permuting empNoIndex sorts your data, right?
Do you know any sorting algorithms?
 
Sarah Bushnell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must confess to only knowing vaguely what your asking. As I said, I've only been on the course 8 weeks, I know vague bits about lots of things and have in-depth knowledge of anything. I've been trying, but Java is only one module and I have 3 others to take into account and you've seen the calibre of our tutor!!!

So far I have the student Id's, marks and grades stored in 2 different arrays.
It is only SUGGESTED that we use an index such as the one above, so if you know of any other ways that could do the job, please PLEASE give me a hint.

And thanks for alos thinking that my tutor is an idiot! He talks to us like we're thick and laughs when we ask for help!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!