Algorithm To Determine If An Applicant Is Approved For An Allocation in A Named Housing Community
Algorithm To Determine If An Applicant Is Approved For An Allocation in A Named Housing Community
Begin
Identify Constants
PC as integer ←$45,000
GC as integer←$35,800
PS as integer ←$25,000
Identify Variables
App_Name as string
HCC as String
Gross_Sal as real
Total_Sal_Deduc as real
Total_Expenses as real
Total_loan_payments as real
Net_Inc as real
Disc_Inc as real
Appro_Status as string
Q_Status as string
Amount_Of_App as integer
Appro_Num as integer
Appro_Sum as real
App_Net_Inc_Avg as real
Begin
Amount_of_app = 0
Appro_Sum=0
Appro_Num=0
While Amount_of_app < 5 DO
Write “Enter the name of the applicant”
Read App_Name
Write “Enter the housing community code of the applicant”
Read HCC
Write “Enter the gross salary of the applicant”
Read Gross_Sal
Write “Enter the salary deductions of the applicant”
Read Total_Sal_Deduc
Write “Enter the total expenses of the applicant”
Read Total_Expenses
Write “Enter the total loan payments of the applicant”
Read Loan
Net_Inc← Gross_Sal – Total_Sal_Deduc
If Net_Inc ≥ PC then
Q_Status= “Qualified”
Else
If Net_Inc ≥ PC then
Q_Status= “Qualified”
Else
If Net_Inc ≥ PS then
Q_Status = “Qualified”
Else
Q_Status= “Not qualified”
Write “Not Qualified”
Endif
Endif
Endif
If Q_Status = “Qualified” Then
Disc_Inc←Net_Inc – ( Total_Expenses+Total_Loan_payments )
Endif
If Disc_Inc ≥0.5*Net_Inc then
Appro_Status= “Approved”
Else
Appro_Status= “Not approved”
Endif
If Appro_Status = “Approved”
Appro_Sum← Appro_Sum + Net_Inc
Endif
If Appro_Status = “Approved” Then
Appro_Num ← Appro_Num + 1
Else
Appro_Num ← Appro_Num + 0
Endif
Print “The name of the applicant is”, App_Name
Print “The Housing Community Applied for is”, HCC
Print “The Qualification of the Applicant is”,Q_Status
Print “The Approval Status of the Applicant is”,Appro_Status
Amount_Of_App = Amount_Of_Apps + 1
Endwhile
App_Net_Inc_Avg = Appro_Sum/Appro_Num
Print “The Number of Approved applicants is”, Appro_Num
Print “The Number of Applicants is”,Amount_Of_App
Print “The Average Net Income of Approved Applicants is “, App_Net_Inc_Avg
End;
End.
Program Monte_Vista_Housing_Community; {Program header}
{A Program to Accept and Store the data of applicants for the Monte Vista Housing Development Agency; Inorder to
calculate the net income of the applicants, determine if they are qualified for an allotment of a house in the
applied for community, calculate their disposable income and determine the approval status .}
Const
PC=$45000; {This is the qualifying income for the community of pebble creek.}
GC=$35800; {This is the qualifying income for the community of Gold Canyon.}
PS=$25000; {This is the qualifying income for the community of Palm Springs.}
Var
HCC:String; {This variable will store the Housing community code that the applicant has applied for}
Gross_Sal:real; {This will store the salary of the applicant before any deductions.}
Total_Expenses:real; {This holds the amount of money the applicant spends per month.}
Total_Loan_payments:real; {This holds the total amount of money that the applicant needs to be repay to the
bank.}
Disc_Inc:real; {This is the income of the applicant after all deductions also known as the balance.}
Q_Status:string; {Determines whether an applicant is qualified or not for the applied housing community.}
Amount_of_app:integer; {This is the control and it stores how many people have applied for Monte Vista Housing.
Appro_Num:integer; {Number of people that have been approved for a house in the community they applied for.}
Begin
Writeln('Programming SBA');
Writeln;
Writeln('For the purpose of determining the approval of applicants for an allocation in the Pebble creek,Gold
canyon,');
Writeln('Please follow the instructions and enter all the necessary information');
Writeln;
Writeln('Thank you!');
Writeln('****************************************************************************************
*****************');
Amount_of_app:=0;
Appro_Sum:=0;
Appro_Num:=0;
While Amount_of_App<5 DO
Writeln;
Writeln('Enter the name of the applicant then press Enter');{Prompts user to enter name of the applicant}
Writeln('Enter the housing community code of the applicant then press Enter');
Readln(HCC);
Readln(Gross_Sal);
Writeln('Enter the total salary deductions of the applicant then press enter');
Readln(Total_Sal_Deduc);
Readln(Total_Expenses);
Writeln('Enter the Total Loan Payments of the applicant then press Enter');
Readln(Total_Loan_payments);
Writeln;
If Net_Inc>=PC then
Q_Status:='Qualified'
Else
Q_Status:='Not Qualified';
{Endif}
If Net_Inc>=GC then
Q_Status:='Qualified'
Else
Q_Status:='Not Qualified';
{Endif}
If Net_Inc>=PS then
Q_Status:='Qualified'
Else
Q_Status:='Not Qualified';
{Endif}
{Endif}
{Endif}
If Q_Status='Qualified'Then
Disc_Inc:=Net_Inc-(Total_Expenses+Total_loan_payments);
{Endif}
If Disc_Inc>=0.5*Net_Inc then
Appro_Status:='Approved'
Else
Appro_Status:='Not approved';
{Endif}
If Appro_Status='Approved'then
Appro_Sum:=Appro_Sum +Net_Inc;
{Endif}
If Appro_Status='Approved' Then
Appro_Num:= Appro_Num + 1
Else
Appro_Num:= Appro_Num + 0;
{Endif}
Writeln('The Name of the applicant is ',App_Name);
Amount_Of_App:= Amount_Of_App + 1;
End;
{Endwhile}
Writeln;
Writeln;
App_Net_Inc_Avg:=Appro_Sum/Appro_Num;
End.