You are on page 1of 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