0% found this document useful (0 votes)
28 views

Program

This program implements an algorithm to determine if election candidates should receive a refund based on the percentage of votes received. It accepts input for 10 candidates, including their name, constituency, votes received, and total votes cast. It then calculates the percentage of votes received for each candidate and outputs whether they should receive a refund or not based on if their percentage is above 20%. Finally, it outputs the total number of candidates eligible for a refund.

Uploaded by

Kxng Mclean
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Program

This program implements an algorithm to determine if election candidates should receive a refund based on the percentage of votes received. It accepts input for 10 candidates, including their name, constituency, votes received, and total votes cast. It then calculates the percentage of votes received for each candidate and outputs whether they should receive a refund or not based on if their percentage is above 20%. Finally, it outputs the total number of candidates eligible for a refund.

Uploaded by

Kxng Mclean
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. a) Develop a problem statement for the algorithm developed in question (1) above.

b) Using the programming language Pascal or VBA, write code to implement/automate


the algorithm in question (1) above.

Program Rocky_Point_Elections;
{This program will accept information for ten candidates who participated in the Rocky Point
Elections. It will determine whether a candidate should receive a refund or not. It will also
calculate and output the total number of candidates who should receive a refund}
Var
Refund: Integer; {This variable will store the number of candidates who should receive a
refund}
Count: Integer;
Votes_Received: Real; {This variable will store the amount of votes a candidate received
in the constituency he/she contested}
Votes_Cast: Real; {This variable will store the total number of votes that were cast in a
particular constituency}
Percent: Real;
Candidate_Name, Constituency: String;
Begin
Refund := 0;
Count := 0;
Writeln(‘Rocky Point Elections Commission’);
Writeln;
Writeln(‘Please Press Enter After Each Piece Of Inserted Information’)
Readln;
While count < 11, do
Begin
Writeln(‘Enter Candidate Name’);
Readln(Candidate_Name);
Writeln(‘Enter Candidate Constituency’);
Readln(Constituency);
Writeln(‘Enter Votes Received’);
Readln(Votes_Received);
Writeln(‘Enter Votes Cast’);
Readln(Votes_Cast);
Percent := (Votes_Received/Votes_Cast) * 100;
If (Percent >= 20) then
Begin
Refund := Refund + 1;
Writeln(Candidate_Name, ‘Refund Due’);
End
Else
Begin
Writeln(Candidate_Name, ‘No Refund’);
End;
End;
Writeln(“The Number of Candidates Who Should Receive a Refund Is”, Refund);
Readln;
End.f

You might also like