This page contains a set of excercises for the corresponding chapter.
Read the task description, copy the code template if present and solve it in your Eclipse.
If you are stuck, you can show the solution for this task. Be careful not to spoil the solution for yourself unnecessarily.
This task is the expansion of the shopping list example from chapter 3.
The output of the program should look like this:
Your are given a list with 10 random generated numbers between 0 and 10.
Your task is to filter odd numbers out of this list and print the filtered list.
The result could look like that:
Hint: you can use removePosition to remove odd numbers or append even numbers to a temporary list.
Your are given a list with 10 random generated numbers between 0 and 10.
Your task is tothis list in ascending order and print the result.
The result could look like that:
Hint: you can compare pairs of neighbouring values and swap them if necessary (google: bubblesort).
Alternatively, you can remove the smallest number from the original list and append it to a temporary list until the original list is empty.
This task is the expansion of the chessboard example from chapter 3.
The resulting output should look like in the image below.
As you can see, a pawn is placed on every field, since it is a default value in this case.
We will solve this issue in chapter 5.