Design the defining diagram, hierarchy chart and the algorithm that will determine the percentage sales commission earned on loyalty customers' purchases from a customer file.

To design the defining diagram, hierarchy chart, and algorithm for determining the percentage sales commission earned on loyalty customers' purchases from a customer file, you can follow these steps:

1. Defining Diagram:
- Identify the entities and relationships involved in the problem. In this case, the entities are "Customers" and "Purchases," and the relationship is "loyalty customers' purchases."
- Represent the entities and their relationships using a diagram. You can use a UML class diagram or an Entity-Relationship (ER) diagram to visually depict these relationships.

2. Hierarchy Chart:
- Construct a hierarchy chart to illustrate the organization and structure of the algorithm.
- Start with a main module that contains the highest-level overview of the algorithm.
- Identify and define sub-modules that perform specific tasks within the algorithm.
- Arrange the sub-modules in a hierarchical structure, with the main module at the top and the sub-modules branching out below.

3. Algorithm:
- Define the steps involved in calculating the percentage sales commission earned on loyalty customers' purchases.
- Here's a simple example algorithm:

```
Main Module:
Read customer file
Repeat for each customer
Calculate commission for the customer
End Repeat

Calculate Commission Module:
If customer is a loyalty customer
Calculate commission percentage based on loyalty status
Calculate commission amount = total purchase amount * commission percentage
Display commission amount
Else
Display "Not a loyalty customer"

```

Note: This is a basic example, and you may need to customize the algorithm based on your specific requirements, such as loyalty tiers, commission rates, or any additional factors to consider.

Remember, this is a general outline, and you should tailor it to fit the specific details of your problem and requirements.