Module: Editor
Version: 4.2.1 +
User: Developer
Difficulty: Difficulty
Introduction
In this exercise we will practise working with Table formulas.
Prerequisites
- The Futurama Editor must be installed.
- Completing the tutorial Working with Tables first, is recommended.
- Completing the exercise Average first, is recommended.
Description
In exercise 1 of this tutorial, we have created a DataTable with the age and income of 20 random people. This DataTable is necessary for this exercise. We will create an overview that will give us some insight in the distribution of the income-heights.
Assignment
Use Futurama to create a function that returns the values for the amount column in the table below. It should count how many times the income lies between the minimum and maximum values.
Minimum | Maximum | Amount |
0 |
10000 |
|
10000 |
20000 |
|
20000 |
30000 |
|
30000 |
40000 |
|
40000 |
50000 |
|
50000 |
60000 |
|
60000 |
70000 |
|
70000 |
80000 |
|
80000 |
90000 |
|
90000 |
100000 |
|
Tips
- Copy the DataTable from exercise 1.
- Use the formula 'SubTable' to create a new table 'Income' with only the income-values.
- Create an 'If'-function with arguments Min and Max that refers to the Income-table and returns '1' if the Income is between Min and Max, and 0 if it is not.
- Create a formula 'Amount' that counts the values returned. Because of the values 1 and 0, you can use the formula 'Sum'. This formula should have the arguments Min and Max as well.
- Create a Range-formula Minimum that defines the minimum-values given in the table above. Create another table for the maximum values.
- Create a Reference to the 'Amount'-function and refer to the minimum and maximum-arrays for the arguments of this formula.
Solutions
Answers
Minimum | Maximum | Amount |
0 |
10000 |
0 |
10000 |
20000 |
3 |
20000 |
30000 |
6 |
30000 |
40000 |
2 |
40000 |
50000 |
3 |
50000 |
60000 |
3 |
60000 |
70000 |
1 |
70000 |
80000 |
0 |
80000 |
90000 |
0 |
90000 |
100000 |
0 |
Download
You can download our solution for this assignment by clicking the image at the right. (Futurama 4.2.1.2)
Please note that you can very well have a different solution that is just as good as ours.
Variations
If you want some more practise on this subject, you could try the extra exercises below.
We won't provide a solution for these variations, just consider them as a way to further experiment with Futurama.
- (Easy:) Have you created two Range-objects for the minimum and maximum? You could create the maximum-formula with the formula Add: Min + 10000.
- (Medium:) Create the same function for ages. Use appropriate boundary values.
- (Difficult:) We now have two arrays for the boundary values: Minimum and Maximum. Try to build a construction that only uses one array, and determines if a value is between the subsequent values in this one array.