Assignment to be sent before Monday 4/12/2017 10:00:
(encode the next functions; make the safety checks and use the functions
Fct_typeCheck and Fct_error for the error messages;
below, "arg" abbreviates "argument", alias, "parameter"):
str_nbOfVoyelSequences(str,iFrom) returns the number of sequences of voyels in
str starting from iFrom, e.g., str_nbOfVoyelSequences("bcaei ouy ",3) returns 2.
You may use "aeiouyAEIOUY".indexOf(c) to test if the character c is a voyel.
[Optional] StringOfDigits_digitOfFirstLonguestDigitSequence(str) returns
the digit of the first longuest digit sequence in str, e.g.,
str_digitOfFirstLonguestDigitSequence("12233345") returns 3 (not "3").
You are not allowed to use an "associative array" (object) to store sequences
and their sizes.
[Optional] str_firstLonguestSequence(str) returns
the first longuest sequence of characters in str, e.g.,
str_firstLonguestSequence("abbcccd") returns "ccc".
You are not allowed to use an "associative array" (object) to store sequences
and their sizes.
ArrayOfNumbers_maxMinusMin(arr) returns the difference between the
greatest (max) and lowest (min) number in arr, e.g.
ArrayOfNumbers_maxMinusMin([2,1,3,5,4]) returns 4 (since 5-1==4).
If arr is empty, the function must return 0. The function must calculate the min and max together, using 1 – and only 1 – loop
and of course it must NOT use predefined functions such as Math.max() to calculate them.
ArrayOfNumbers_multiplyNonZeroNumbersAtOddIndexesAndAddLastNumber(arr)
first multiplies all the non-zero numbers (i.e., != 0) in arr that are at odd indexes in arr
then add to this product the last number in arr and returns the result., e.g.,
ArrayOfNumbers_multiplyNonZeroNumbersAtOddIndexesAndAddLastNumber([7,0,8,2,5,3,4])
returns 10 (since 2*3 + 4 == 10).