Algorithm
Algorithm: Refunded Candidates
Start
Declaration of Variables
String: Candidatename
Integer: votesreceived, votescast, refund, candidates
Initialization of Variables
votesreceived = 0
votescast = 0
Refund = 0
FOR Candidates = 1 to 10 Do
PRINT (input (“Enter Candidate Name”))
READ candidatename
PRINT (input (“Enter Votes Received”))
READ votesreceived
PRINT (input (“Enter Votes Cast”))
READ votescast
IF Votes Received > 20/100 * votescast THEN
PRINT (candidatename, “Has A Refund Due”)
Refund = Refund + 1
ELSE
PRINT (candidatename “Has No Refund Due”)
Refund = Refund
END For
PRINT (Refund, “Candidate Has Received Refund”)
END
Trace Table
Candidates Candidate Votes Votes Cast Refund Output
Name Received
1 Shane Razak 956 6375 0 Shane Razak
Has No
Refund Due
2 Adrian 1173 5865 0+1 Adrian
Kennedy Kennedy Has
A Refund Due
3 Jerron 2142 6120 1+1 Jerron
Sookram Sookram Has
A Refund Due
4 Eric Persaud 1960 5600 2+1 Eric Persaud
Has A Refund
Due
5 Ike Crawford 1065 5325 3+1 Ike Crawford
Has A Refund
Due
6 Aaron Beharry 1069 7128 4 Aaron Beharry
Has No
Refund Due
7 Irfan Ally 2239 7462 4+1 Irfan Ally Has
A Refund Due
8 Devyani Singh 2625 7500 5 Devyani Singh
Has No
Refund Due
9 Ravindra 1339 8925 5 Ravindra
Persaud Persaud Has
No Refund
Due
10 Mark 1107 7380 5 Mark
McKenzie McKenzie Has
No Refund
Due
Source code:
Refund = 0
for Candidates in range(10):
Candidate_Name: str = input("Enter Candidate Name: ")
Votes_Rececived = int(input("Enter Votes Received: "))
Votes_Cast = int(input("Enter Votes Cast: "))
if Votes_Rececived > 20 / 100 * Votes_Cast:
print(Candidate_Name, "Has A Refund Due \n")
Refund = Refund + 1
else:
print(Candidate_Name, "Has No Refund Due \n")
Refund = Refund
print(Refund, "Candidates have received a refund")