A sampling of real-world problems, ranging from the simple to the complex, whose solutions are discovered by the students.
(Use ArrayTotal() from Friday. We declared it as
public static double ArrayTotal(double[] arr) { ... }in case you forgot.)
+----+----+----+----+----+ | 96 | 87 | 99 | 56 | 92 | +----+----+----+----+----+
x == 2.5, n == 2
+----+----+----+----+----+----+ | 56 | 17 | 2 | 42 | 5 | 97 | n == 42 +----+----+----+----+----+----+
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 'I' | ' ' | 'l' | 'i' | 'k' | 'e' | ' ' | 'P' | 'G' | 'S' | 'S' | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ old == 'k', new == 'v'
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 'I' | ' ' | 'l' | 'i' | 'v' | 'e' | ' ' | 'P' | 'G' | 'S' | 'S' | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
+---+---+---+---+---+ | 1 | 0 | 0 | 0 | 1 | +---+---+---+---+---+
+----+----+ +----+----+ | 5 | 8 | | 6 | -5 | +----+----+ +----+----+ a == | 0 | -1 | b == | 2 | 1 | +----+----+ +----+----+ | 2 | 5 | | 0 | 0 | +----+----+ +----+----+
+----+----+ | 11 | 3 | +----+----+ | 2 | 0 | +----+----+ | 2 | 5 | +----+----+
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ str == | 'I' | ' ' | 'l' | 'i' | 'k' | 'e' | ' ' | 'P' | 'g' | 'h' | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ +-----+-----+-----+ query == | 'o' | 'v' | 'e' | +-----+-----+-----+
+----+----+----+----+----+----+----+ | 5 | 8 | 42 | 1 | 3 | 5 | 6 | +----+----+----+----+----+----+----+ n == 5
+----+----+----+----+----+----+----+ | 8 | 42 | 1 | 3 | 6 | 5 | 5 | +----+----+----+----+----+----+----+