The Code-Bin
untitled Java Code
Posted by: olly | May 10, 2011 @ 2:53pm
Revision 1 - Original post on May 7, 2011 @ 10:09am

Java Code



Syntax Highlighting





Author Comments
If any body can help me I would appreciate it you can contact me
on oliviacelticghirl@hotmail.co.uk

I'm trying to figure out this question that was assigned to me, as
I haven't done much javascript before I'm not sure if this is
correct. If any body could help it would be greatly appreciated.

The question is as follows:

You are provided with a string array called country that contains
the name of every country that the Ski Club visits. For example
one element of this array might be as follows:

country[0] = "Austria"

Another array called villages contains strings with information on
village names and altitude in a particular country. For example:

villages[0] = "Austria:Seefield 850m*";

Write a JavaScript function snowReport(countryIndex) that will use
the arrays provided to write a report of all villages that include a
given country. The function will be passed an integer representing
the index of an element of the country array.

A match is found if the country appears in a string (Hint use
appropriate JavaScript function to evaluate if a country name is
contained in a village string.)

All matching villages should be displayed. Output should be
displayed in the villages div element you defined in part (a).
Output is shown for a search for Austria in Figure 1b.



Rating


4.52 / 8
199 Votes