Psuedocode

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

--This algorithm will accept the first name, last name, respective category and amount paid from

25 members. Based on the information inputted, this algorithm will then calculate the amount
due, amount outstanding, fine amount, the overall total paid by all 25 members, maximum
outstanding amount, total number of people with outstanding amount and average fines.

--Declaration of constants
CONST
Fpercent = 0.045
Noofmonths = 12
Monthlyrate1 = 50.00
Monthlyrate2 = 100.00
Monthlyrate3 = 150.00
Monthlyrate4 = 200.00

--Declaration of variables
DECLARE
Ftname, Ltname, Category AS STRING
Amtdue, Amtoutd, Amtpaid, Feamount, Ovtotal, Max_amtoutd, Tfamt, Avfine AS REAL
Tno_outppl, Count AS INTEGER

START

--Initialization of variables used for counting, accumulating, or comparison


Ovtotal = 0.00
Tfamt = 0.00
Tno_outppl = 0
Max_amtoutd = 0.00

FOR Count = 1 TO 25 DO
PRINT "Please enter first name"
READ Ftname
PRINT "Please enter last name"
READ Ltname
PRINT "Please enter category"
READ Category
PRINT "Please enter amount paid"
READ Amtpaid
--Calculating amount due based on member’s category rate
IF (Category = 'ST') THEN
Amtdue = Noofmonths * Monthlyrate1

ELSEIF (Category = 'AS') THEN


Amtdue = Noofmonths * Monthlyrate2

ELSEIF (Category = 'FU') THEN


Amtdue = Noofmonths * Monthlyrate3

ELSEIF
Amtdue = Noofmonths * Monthlyrate4
ENDIF

--Calculating amount outstanding based on the amount due and amount paid by the member
Amtoutd = Amtdue - Amtpaid

--Calculating the fine amount and total fine amount based on the amount outstanding by the member
IF (Amtoutd = 0) THEN
Feamount = 0

ELSEIF
Feamount ← Amtoutd * Fpercent
Tfamt = Tfamt + Feamount
ENDIF

--Counting the number of members with outstanding costs


IF (Amtoutd > 0) THEN
Tno_outppl = Tno_outppl + 1
ENDIF

--Calculating the maximum outstanding amount


IF (Amtoutd > Max_amtoutd) THEN
Max_amtoutd ← Amtoutd
ENDIF
--Outputting the details for each member
PRINT "Your first name is ", Ftname
PRINT "Your last name is ", Ltname
PRINT "Your category is", Category
PRINT "Your amount due is $", Amtdue
PRINT "Your amount paid is $", Amtpaid
PRINT "Your amount outstanding is $", Amtoutd
PRINT "Your fine amount is $", Feamount

Ovtotal = Ovtotal + Amtpaid -- Calculating the total amount paid


Count = Count + 1 -- Counting the number of times the loop iterates
ENDFOR

Avfine = Tfamt / Tno_outppl -- Calculating the average fine amount

--Outputting overall amounts


PRINT "The total paid is $", Ovtotal
PRINT "The maximum outstanding amount is $", Max_amtoutd
PRINT "The number of people with outstanding amount is", Tno_outppl
PRINT "The average fine is $", Avfine

STOP

You might also like