1.Do the planning and write an algorithm to solve the following problem. Prepare test data for the example to test all possibilities and draw a trace table.

Sam works at a coffee company where all the employees receive a bonus of R700, except the employees in the coffee department 3, who receive a bonus of R850. Enter his gross salary and his personal department number. Calculate the total income of Sam. Subtract 25% of the gross income for tax. Determine and display Sam’s net income on the screen

To solve the problem, we can follow the steps below:

1. Get the employee's gross salary and department number as input.
2. Check if the department number is 3.
3. If the department number is 3, add R850 to the gross salary as the bonus.
4. If the department number is not 3, add R700 to the gross salary as the bonus.
5. Calculate the tax amount by subtracting 25% of the gross salary.
6. Calculate the net income by subtracting the tax amount from the total income (gross salary + bonus).
7. Display the net income on the screen.

Here is the algorithm in pseudo code:

```
1. Get gross salary and department number from the user.
2. If department number is 3,
- set bonus = R850
Else,
- set bonus = R700
3. Set total income = gross salary + bonus
4. Set tax amount = 0.25 * gross salary
5. Set net income = total income - tax amount
6. Display net income.
```

Now, let's prepare the test data by considering the following examples:

Example 1:
- Gross salary = R5000
- Department number = 3

Example 2:
- Gross salary = R7000
- Department number = 5

Example 3:
- Gross salary = R10000
- Department number = 3

Example 4:
- Gross salary = R4000
- Department number = 2

You can now create a trace table to demonstrate how the algorithm works with the test data. A trace table helps keep track of variable values as the algorithm progresses, making it easier to debug and understand the logic behind the code.