Do the planning and write an algorithm

for the following questions. Each problem
contain a do loop. When planning your
algorithm, decide which type of loop will be
best suited to solving the particular problem
(pre-test or post-test). If the problem
contain a decision to be made, decide
whether you’ll use an if statement or a
select case statement. You can assume that
all the input data for the following questions
will be valid.
Peter decided to save money to buy a
house. Enter this amount as well as the
amount he will be able to save each month.
He earns 0.8% interest per month while the
amount is less than R70,000 and 0,7%
interest per month if the amount is equal to
or more that R70,000. The interest is added
to the total amount. Calculate how many
months he will have to save before he has
reached his goal. Display the final amount
and the number of months.

To solve this problem, we can use a post-test loop since we want to continue looping until Peter reaches his goal. We will use an if statement to determine the interest rate based on the amount saved.

Here is an algorithm to solve the problem:

1. Initialize the following variables:
- goalAmount = 0 (the amount Peter wants to save for the house)
- savedAmount = 0 (the amount Peter has currently saved)
- monthlySaving = 0 (the amount Peter can save each month)
- interestRate = 0 (the interest rate to be applied)

2. Prompt the user to enter the goal amount and save it in the variable goalAmount.
3. Prompt the user to enter the monthly saving amount and save it in the variable monthlySaving.

4. Set the loop condition: while savedAmount is less than goalAmount, do the following steps:
a. Use an if statement to determine the interest rate based on the savedAmount:
- If savedAmount is less than R70,000, set interestRate to 0.8%.
- If savedAmount is equal to or more than R70,000, set interestRate to 0.7%.

b. Calculate the interest on the savedAmount using the formula: interest = savedAmount * interestRate.
c. Add the interest to the savedAmount: savedAmount = savedAmount + interest.
d. Add the monthlySaving to the savedAmount: savedAmount = savedAmount + monthlySaving.

5. Display the final amount saved: savedAmount.
6. Calculate the number of months it took to reach the goal: numberOfMonths = savedAmount / monthlySaving.
7. Display the number of months: numberOfMonths.

This algorithm calculates the amount Peter will have saved after each month, taking into account the interest rate based on the current amount saved. The loop continues until the goal amount is reached, and then it displays the final amount and the number of months it took to reach the goal.