Exercise 1

1 Question

What is a range vector?


1.1

A range vector is a vector containing a range of numeric values increasing or decreasing by a fixed increment or decrement value for each additional element.


2 Question

Give an example of a range vector with 5 Integers increasing by 5 for each additional element.


2.1

{5, 10, 15, 20, 25}


3 Considering Array Ranges

Which result do the v1, v2, v3, v4 and v5 have below?



3.1

v1 has the value {3, 4, 5, 6, 7, 8}
v2 has the value {-20, -19, -18, -17, -16, -15, -14, -13, -12, -11}
v3 has the value {11.3, 12.3, 13.3, 14.3, 15.3}
v4 is an empty vector
v5 has the value {1.1, 2.1, 3.1}


3.1.1 Simulation of RangeVectors


4 Wider Ranges

How can you construct the range vectors below?

{15.0, 18.0, 21.0, 24.0, 27.0},
{-6.5, -8.5, -10.5} and
an empty Integer vector.

Write the class containing the vectors here:



4.1

These vectors are just examples of how the vectors can be constructed. There is more than one solution to every vector.



4.1.1 Simulation of RangeVectors2