1. Member
Join Date
Aug 2011
Posts
4
Rep Power
0

Hi there
I have a scenario where a wildlife observer is looking for animals in the wild. The observer must enter a number 1-8 depending on the animal he sees. which could look like this
1
4
3
3
1
8
4
2
3
and so on
I need to make an array with 7 animals. hippo, cheetah, buffalo, monkey, zebra, tiger, snake and Rhino

I need to attach these animals to an array 1 - 8.
then I want to use the scanner tool so the user can enter the numbers in at random according to what animal he sees.
Also each animal in the array needs a counter so it can increment how many times the observer sees the particular animal. then if the user presses 0 a summary of data will come up.

2. Can an observer see different sorts of animals? e.g. can s/he see two hippos and three cheetahs? Or is only one sort of animal visible at a certain moment in time? Pleae specify.

kind regards,

Jos

3. Member
Join Date
Aug 2011
Posts
4
Rep Power
0
Hi Jos
Very unrealistically yes the observer only sees one at a time, so if he sees two rhinos it needs to be inputted like
2
2
if that makes sense

thanks

4. What have you tried so far? Do you need to use an array? A map could be helpful in a situation like this.

5. Member
Join Date
Aug 2011
Posts
4
Rep Power
0
Yeah Im have to use an array, (Not 2 dimensional)
Its meant to be straight forward but im really new to this. I have done it like this so far
vehicle = new int[7];
Scanner scanner = new Scanner(System.in);
Animal[0] = 1;
Animal[1] = 2;
Animal[2] = 3;
Animal[3] = 4;
Animal[4] = 5;
Animal[5] = 6;
Animal[6] = 7;
Animal[7] = 8;
However the scanner doesn't pick up the digits when i type them in. I also need to have a counter for each and that needs to increment each time a number is entered if that makes sense. Am i on the right track?

6. Your scanner line simply creates the object, however; it doesn't actually use it. Your pseudocode should look something like this

Java Code:
```create scanner
create array of size x
loop
get input from user with scanner
fill slot of array
end loop```
This is a very basic representation. How are people supposed to know which type of animal goes in which array slot?

7. Member
Join Date
Aug 2011
Posts
4
Rep Power
0
Ahh missed that part, They know what number goes with the animal. Lets assume the observer sees a rhino he knows to press 5

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•