Just a Few Questions

I'd just like to find out the answers to my questions that so far I haven't been able to find.
For example:

1)I'm creating a menu based program. The users need to press '1' to initialise the 'contact detail list' i'm creating. As the program is made up of four separate arrays, would that mean setting the active entry counter to zero separately for all the arrays? E.g.

What I don't understand about this is that my program is called 'StudentContactManager' (which is what I was told to call it). Also, due to the fact that the program is made up of four arrays each with different names, how does the above code work i.e. if contact detail list contains entries.

3) Due to the fact that i'm using arrays with a fixed size, is it possible to 'insert new contact details into contact detail list' as i'm told to do?

4)The biggest problem i've had is to do with insertion points. I assume that where it says 'set insertion point of new entry to first entry' it means i = 0;. But i'm totally lost when it comes to the stage where it says:

IF Enrolment number is greater than enrolment number in last entry THEN
Set insertion point of new entry to entry after current last entry
ELSE
Locate insertion point of new contact detail
Move subsequent existing contact detail entries one position
END-IF
END-IF
Insert new contact detail at insertion point over-writing any previous contact
detail entry
END

Locate insertion point of new contact detail

BEGIN
Set insertion point identifier to first position
WHILE enrolment number to insert is greater than enrolment number stored at position identified by insertion point identifier
DO
Increment insertion point identifier
END-WHILE
END

I know it probably looks like I want someone else to do my work for me, but i've been on numerous forums asking for explanations, i've got books that don't cover what I need, i've asked friends who are like me and don't have a clue and so this is my last chance for some pointers - either that or a fail!!

i wasn't exactly sure what you were asking for some of the questions, but for number 3, reguarding array size, i've run into this issue before, so what i did was, i first created an ArrayList<Integer> in order to first get all of the nums, and then once you have all the numbers in that ArrayList, you can just make a new int array whose size is the size of the arraylist (arraylistname.size()).

I think your instructor wants you to us arrays instead of more advanced data structures, like the one gibsonrocker800 mentioned, since your pseudo code said:

Java Code:

IF Enrolment number is greater than enrolment number in last entry THEN
Set insertion point of new entry to entry after current last entry
ELSE
Locate insertion point of new contact detail
[B]Move subsequent existing contact detail entries one position[/B]
END-IF
Insert new contact detail at insertion point over-writing any previous contact
detail entry
END

I would use integer variables used for counting purposes and a few for loops.

Eyes dwelling into the past are blind to what lies in the future. Step carefully.

hm, well tim i think maybe he HAS to use arrays (maybe the teacher wants to teach the students the use of arrays). if so, do you know how else could he update the size of the array without using an ArrayList like i mentioned? (i would like to know for my own programs).

Yes we were told to use basic arrays due to us being beginners at Java.

The first question I asked about active entries - basically if the user looks at the menu and presses '1', the Contact Detail List will be initialised. Now as the program is made up of four separate arrays,does this mean that I have to write out the four arrays and write 'int active entries = 0; beneath all of the four arrays or only write it once underneath the last array written?

The second question is about my confusion arising from the provided pseudocode. We are to call our program 'StudentContactManager'. In the following piece of pseudocode, it keeps mentioning 'contact detail list':

As i've said, the program is made up of four arrays, with each array holding separate information on ten students. As I name my arrays differently, i.e. firstName, lastName - why does it say for example 'display contact detail list'

Well, gibsonrocker800, I like to use Vector objects. They are very easy to handle, especially if you use generics. Vectors update their size automatically, and they really have great functionality. Vector objects can make pringle's or any other programmer's task fairly straightforward. :D Look in the java.util package.

Eyes dwelling into the past are blind to what lies in the future. Step carefully.

You may have already known how to do this. But there it is, either way.

So now, the arrays should be written in the beginning of the programming so that it is within the scope of each case in the switch statement. (AKA, within the range).

As for your second question, it has that option so that the user can see all of the contact details. So, within case 1, you will have it print out all of the details using a for each loop. (or you could use a for loop, but for each is more efficient when dealing with all of the elements in an array). so:

Yes we were told to use basic arrays due to us being beginners at Java.

The first question I asked about active entries - basically if the user looks at the menu and presses '1', the Contact Detail List will be initialised. Now as the program is made up of four separate arrays,does this mean that I have to write out the four arrays and write 'int active entries = 0; beneath all of the four arrays or only write it once underneath the last array written?

The second question is about my confusion arising from the provided pseudocode. We are to call our program 'StudentContactManager'. In the following piece of pseudocode, it keeps mentioning 'contact detail list':

As i've said, the program is made up of four arrays, with each array holding separate information on ten students. As I name my arrays differently, i.e. firstName, lastName - why does it say for example 'display contact detail list'

Hopefully that helps :o

Okay, I'll try and help you.
I did a similar thing at varsity. It appears to me that you must create a method that does the correct action depending on what the user enters, so you will need five methods. I would have another method that displays the menu.

Menu option 1:
Initialize the arrays by using the new keyword and choose an integer limit on the size of your data structure. Now, set the active entry counter to zero once, after you created the arrays.

tim meant that, do you want your program to be a graphical user interface, meaning that should it have a window that pops up where you choose things by clicking on buttons and stuff like that, or do you want it to be completely text-driven (seen through the console, using Scanner and System.out.println in order to input and ouput). I personally think that you should just make it non-graphical, because making it graphical is a whole different topic, which is alot more advanced (you gotta learn about events, buttons, etc.). So, for now, lets get this working by using the console, and then, we'll try to make it graphical (you're teacher will be impressed =]).

also, keep in mind that switch statements can not run on Strings, as you did in your previous post:

"Case initialise:"

it would have to be : case 1 ... or case 2

switch statements can only rely on primitive types (i'm not completely positive if it can run on longs, shorts, doubles, and floats, but i know for a fact that it can work with ints, bytes, and chars).
What this all means is that, you could never have the following example:

Well i've attempted about three quarters of the pseudocode and wondered if somebody could check whether what i've done is correct. I'm willing to pay for your troubles.

Could you please post your code, i would like to check your code. And, i don't think anyone on this site would even consider taking money from anyone for checking their code; we do it out of pure love of the subject.

Hey, i was going to respond in my AP Comp Science class, and i typed up a response and i accidentally hit "Go Advanced" instead of Post Quick Reply, and so my entire reply was gone lol. So, here is my reply:

Your syntax is a bit off. I can't remember exactly what you did, but i remember you had like if (x > 5 && x < 1) ... Now this would never evaluate to be true, because there's no way x could be greater than 5 AND less than 1. Use || (OR) instead.

It's because i've written the code in Microsoft Word so they automatically think that i'd like a capital at the start of every line! Well, I know that the array initialisations are wrong, my brackets are all over the place amongst other things so i'll alter them today to make the code a little more respectable!