You are on page 1of 4

Program

Program Monte_Vista_Housing; {Program header}

{A Program which accepts amd stores data for


applicants who applied for housing at the Monte
Vista Housing Development Agency to determine
if an applicant is approved for allocation of a
house in a named housing community}

Const
PC=45000; {Data that remain unchanged throughout experiment}
GC=35800;
PS=25000;
Var
App_Name:string;
HCC:String; {Housing Community Code}
Gros_Sal:real; {Gross salary}
Sal_Deduc:real;
Total_Ex:real;
Total_Loan_Rep:real; {Total loan repayment}
Net_In:real; {Net income}
Dis_In:real; {Disposable income, Balance}
Qual_Status:string;
Appr_Status:string;
Appr_Num:integer; {Number of approved applicants}
Appr_Sum:real; {Sum of net income of approved applicants}
Num_Of_Apps:integer; {Number of approved applicants}
Appr_Avg:real;
Begin
Writeln('Created by Romani Osbourne'); {Program documentation which gives information about
the programmer}
Writeln('Centre name:Titchfield High School');
Writeln('Centre no.: 100121');
Writeln('Completed February 2019');
Writeln('Teacher: Ms. P. Clarke');
Writeln ('Component: Problem solving/Programming');
Writeln;
Num_Of_Apps:=0; {Initializing the total number of applicants}
Appr_Sum:=0; {Initializing the sum of net income of approved appplicants}
Appr_Num:=0; {Initializing the total number of approved applicants}
While Num_Of_Apps<5 DO {The code between While and Endwhile while be executed until the
amount of applicants equals 5, when the number
of applicants is equal to 5, the loop will end}
Begin
Writeln('Please enter the applicant name and press enter');
Readln(App_Name);
Writeln('Please enter the housing community code choosen by the applicant');
Readln(HCC);
Writeln('Please enter the applicant gross salary and press enter');
Readln(Gros_Sal);
Writeln('Please enter the applicant salary deductions and press enter');
Readln(Sal_Deduc);
Writeln('Please enter the applicant total expenses and press enter');
Readln(Total_Ex);
Writeln('Please enter the applicant total loan repayments and press enter');
Readln(Total_Loan_Rep);
Net_In:=Gros_Sal-Sal_Deduc; {Calculting net income by subtacting salary deductions from gross
salary}
If Net_In>=PC then {Condition that determines whether or not an applicant is qaulified for PC}
Qual_Status:='Qualified'
Else
Qual_Status:='Not Qualified';
{Endif}
If Net_In>=GC then {Condition that determines whether or not an applicant is qaulified for GC}
Qual_Status:='Qualified'
Else
Qual_Status:='Not Qualified';
{Endif}
If Net_In>=PS then {Condition that determines whether or not an applicant is qaulified for PS}
Qual_Status:='Qualified'
Else
Qual_Status:='Not Qualified';
{Endif}

If Net_In>=PC then
Writeln('Qualifies for PC')
Else

If Net_In>=GC then
Writeln('Qualifies for GC')

Else
If Net_In>=PS then
Writeln('Qualifies for PS')
Else
Writeln('Qualifies for Nothing');
{Endif}
{Endif}
{Endif}

If Qual_Status='Qualified'Then
Dis_In:=Net_In-(Total_Ex+Total_Loan_Rep)
{Endif};

If Dis_In>=0.5*Net_In Then {Calculating disposable income/balance by multiplying generated net


income by half to determine whether or not an applicant is approved}
Appr_Status:='Approved'
Else
Appr_Status:='Not approved';
{Endif}

If Appr_Status='Approved'then
Appr_Sum:=Appr_Sum +Net_In; {The variable Appr_Sum will be updated with the value entered by
the user. It is acting as an accumulator by keeping a
running total of net income for approved applicants}
{Endif}

If Appr_Status='Approved' Then
Appr_Num:= Appr_Num + 1
Else
Appr_Num:= Appr_Num + 0; {The variable Appr_Num will not act as an accumulator if condition is not
true}
{Endif}

Writeln('The Applicants Name is ', App_Name); {Program is instructed to write the outputs}
Writeln('The Housing Community Applied for is ', HCC);
Writeln('The Applicant net income is', Net_In:2:2);
Writeln('The Applicant is ',Qual_Status);
Writeln('The Applicant balance is', Dis_In:2:2);
Writeln('The Approval Status of the Applicant is ',Appr_Status);
Num_Of_Apps:= Num_Of_Apps + 1; {Num_Of_Apps acting as an accumulator, accumulating the
number of applicants as they are inputted}
End;
{Endwhile}
Writeln;
Appr_Avg:=Appr_Sum/Appr_Num; {Calculating average net income by dividing the total net income of
approved applicants by the total number of approved applicants}
Writeln('The Number of Approved applicants is ', Appr_Num);
Writeln('The Number of Applicants is ', Num_Of_Apps);
Writeln('The Average Net Income of Approved Applicants is ',Appr_Avg:2:2);
End.

You might also like