You are on page 1of 8

Cover Page

Candidate Name: Shoshana Singh

Candidate Grade: 11MB2

Candidate Number:

Centre Number: 090018

Centre Name: Corentyne Comprehensive High School

Year of Examination: 2024

Subject: Information Technology SBA

Title: Problem Solving and Programming Design

Sir: Darrel George

Territory: Guyana

Problem Solving and Programming

1
Algorithm

Definition of Problem:

To develop an algorithm to calculate the commission earned by sales staff members based on
their total sales for October 2024. The algorithm should find the staff member with the highest
commission and display their name, total sales, and commission, as well as the number of staff
members without commission.

Proposed Solution:

1. Create a list of Sales Staff Members with their names

2. Create a dictionary to store each staff member's total sales and commission

3. Create a variable to store the maximum commission earned and initialize it to zero

4. Loop through the Sales Staff Members list and ask the user for the total sales for each staff
member

5. Calculate the commission earned by multiplying total sales by 0.03 (3%)

6. Store the total sales and commission earned in the Sales Staff Members dictionary

7. If the commission earned is greater than the maximum commission earned, update the
maximum commission earned and the name of the staff member who earned it

8. Count the number of staff members with no commission earned, and store this in a variable

9. Loop through the Sales Staff Members dictionary and increment the counter if the commission
earned is zero

10. Display the name, total sales, and commission earned of the staff member with the maximum
commission

11. Display the total number of staff members who earned no commission

12. End the program

2
Algorithm:

1. Let Sales Staff be the list of Sales Staff Members:

Sandiya Wheeler, Linda Davis, Rebecca Perry, Laura Lee, Anna Blake, Nancy Walker, Anita
Blue, Justin Mike, Patrick Ark, Gary Switch, Steve Bling, Adam Berry, Ray Margon, Devina
Black, Rick Richards, Sonia Clark

2. Let Sales Staff Data be an empty dictionary to store each staff member's total sales and
commission

3. Let Max Commission be a variable initialized to zero

4. For each staff member in Sales Staff:

a. Prompt the user to enter their total sales for October 2024

b. Calculate their commission earned by multiplying their total sales by 0.03

c. Store their total sales and commission earned in the Sales Staff Data dictionary

d. If their commission earned is greater than Max Commission, update Max Commission and the
name of the staff member who earned it

5. Let No Commission be a variable initialized to zero

6. For each staff member in Sales Staff Data:

a. If their commission earned is zero, increment No Commission

7. Display the name, total sales, and commission earned of the staff member with the maximum
commission

8. Display the total number of staff members who earned no commission

9. End the program

3
Testing and Validation:

The algorithm were by inputting the sales data for each staff member and checking if the
calculated commission is correct. We can also verify that the staff member with the highest
commission is correctly identified and that the number of staff members with no commission is
accurate.

Most efficient solution:

The proposed solution has a time complexity of O (n), which is linear, as it loops through each
staff member in the Sales Staff list and the Sales Staff Data dictionary. This solution is efficient
for processing and analyzing the sales data of a small number of staff members. If the number of
staff members or the amount of data was significantly larger, more efficient algorithms such as
sort and search could be used to optimize the solution. However, for the given problem
statement, the proposed solution is simple and efficient.

4
Trace Table

To create a trace table, we need to calculate the commission for each staff member based on their
total sales. Using the provided total sales for each staff member ($8,175.0) and a commission
rate of 3%, we can calculate the commission as shown below:

FIRST NAME LAST NAME TOTAL SALES COMMISSION


Sandiya Wheeler $8175.0 $245.25
Linda Davis $8175.0 $245.25
Rebecca Perry $8175.0 $245.25
Laura Lee $8175.0 $245.25
Anna Blake $8175.0 $245.25
Nancy Walker $8175.0 $245.25
Anita Blue $8175.0 $245.25
Justin Mike $8175.0 $245.25
Patrick Ark $8175.0 $245.25
Gary Switch $8175.0 $245.25
Steve Bling $8175.0 $245.25
Adam Berry $8175.0 $245.25
Ray Margan $8175.0 $245.25
Devina Black $8175.0 $245.25
Rick Richards $8175.0 $245.25
Sonia Clark $8175.0 $245.25

The commission for each staff member is $245.25. Since all staff members have made sales,
there are no staff members without commission. The highest commission earned is $245.25 for
each staff member.

5
Program Implementation

(a) Problem Statement:


Develop a program that will calculate the commission earned by each Sales Staff Member in a
company based on their total sales for the month of October 2024. The commission rate is 3% of
their total sales. The program should display the name, total sales and commission earned of the
staff member with the highest commission earned, as well as the total number of staff members
who earned no commission.
(b) Python Code:
# Define a list of Sales Staff Members
Sales Staff = ["Sandiya Wheeler", "Linda Davis", "Rebecca Perry", "Laura Lee", "Anna Blake",
"Nancy Walker", "Anita Blue", "Justin Mike", "Patrick Ark", "Gary Switch", "Steve Bling",
"Adam Berry", "Ray Margon", "Devina Black", "Rick Richards", "Sonia Clark"]
# Define an empty dictionary to store each staff member's total sales and commission earned
Sales Staff Data = {}
# Loop through each staff member in the Sales Staff list
For staff in Sales Staff:
# Prompt the user to enter the staff member's total sales for October 2024
Sales = into (input ("Enter” + staff + "'s total sales for October 2024: "))
# Calculate the staff member's commission earned
Commission = sales * 0.03
# Store the staff member's total sales and commission earned in the Sales Staff Data dictionary
Sales Staff Data [staff] = {"Total Sales": sales, "Commission": commission}
# Sort the Sales Staff Data dictionary by commission earned in descending order
Sorted Sales Data = sorted (Sales Staff Data. items (), key=lambda x: x [1] ["Commission"],
reverse=True)
# Display the name, total sales, and commission earned of the staff member with the highest
commission earned

6
Print ("Sales staff member with the highest commission earned :")
Print ("Name:” Sorted Sales Data [0] [0])
Print ("Total Sales:” Sorted Sales Data [0] [1] ["Total Sales"])
Print ("Commission:” Sorted Sales Data [0] [1] ["Commission"])
# Count the number of staff members with zero commission earned
No Commission Count = 0
For staff in Sales Staff Data:
If Sales Staff Data [staff] ["Commission"] == 0.0:
No Commission Count += 1
# Display the total number of staff members who earned no commission
Print ("Number of staff members who earned no commission:” no Commission Count)
```
Note: This program assumes that the total sales data is provided by the user at runtime using the
`input () ` function.

7
THE END

You might also like