You are on page 1of 15

NHT Housing Solution

by
Lisa Forbes-Arnold

An assignment submitted in partial fulfillment of the requirements


for the course C Programming
Instructor: Mr. Adrian Vanhorne
Date: May 17, 2014

Department of Communication and Information Technology


Bethlehem Moravian College

/* Program to calculate monthly NHT mortgage


Created by Lisa Arnold*/
#include <stdio.h>
#include <math.h>
# include <string.h>

int iApplicant_Count=0;
int iApproved_Count=0;
int iAge=0;
int main()
{
while(iAge != 999)
{
char cApplicant_Name[50] ;
char cSpouse[20];
float fBalance;
float fGross_Salary ;

float fLoan_Amt ;
int iLoan_Period ;
float fMonthly_Rate;
float fMortgage_Payment;
float fNet_Income;
float fNHT_Points=20;
float fNumber_of_Payments;
char cQualified_Stats[20];
float fTotal_Expenses;
float fTot_Sal_Deduc;
float fWeekly_Income;
float fYOC;
int iPts_Alloted;
float fTotal_NHT_Pts;
double n,i;
double fInterest_Rate=0;

char cApplicant_Stats[20];
printf("\t\t*** WELCOME to NHT the key to your HOME***\n");
printf("\t\t\t Application for Home Loan\n\n");
printf("Enter Applicant Name :");
scanf ("%[^\n]%*c",cApplicant_Name);
printf("Does the applicant have a spouse(y/n) :");
scanf ("%s",cSpouse);
printf("Enter Applicant Gross Salary :$");
scanf ("%f",& fGross_Salary);
printf("Enter Applicant Total Salary Deduction :$");
scanf ("%f",& fTot_Sal_Deduc);
printf("Enter the number of years applicant have contributed to the NHT Trust Fund :");
scanf ("%f",& fYOC);
printf("Enter Applicant Total Expenses :$");
scanf ("%f",& fTotal_Expenses);
printf("\n\n");

printf("\t***** MANDEVILLE SERVICE LOTS*****\n");


printf(" \tThe Service Lots along with the costs are listed below\n");
printf("\t\t* Godfrey Lands:$1,000,000\n");
printf("\t\t* Woodlawn Housing Scheme :$1,500,000\n");
printf("\t\t*Ingleside :$1,900,000\n\n");
if( (cSpouse[0] =='y') || (cSpouse[0] =='Y'))
printf( "Applicant can borrow up to $7,000,000 in loan with spouse.\n ");
else
printf("Applicant can borrow up to $3,500,000 in loan.\n ");
printf("Enter Loan Amount : $");
scanf ("%f",& fLoan_Amt);
printf("Maximum Loan Period for applicant is 30 years\n");
printf("Enter Loan Period: ");
scanf ("%d",&iLoan_Period);
printf("Enter an age between 18 and 65 years or Enter 999 to terminate program\n");
scanf ("%d",& iAge);

if(iAge == 999)
{
return 0;
}
iApplicant_Count= iApplicant_Count+1;
if ((iAge < 18) || (iAge > 65) )
{
printf("Applicant can only earns points if their age >= 18 and age <= 65. \n");
printf("Therefore applicant will not have NHT Points at age %d \n",iAge);
}
fNet_Income=fGross_Salary- fTot_Sal_Deduc;
fWeekly_Income= fGross_Salary/4;
fBalance= fNet_Income- fTotal_Expenses;
if ((fWeekly_Income < 7501)){
fInterest_Rate = 0.02;
}else if( fWeekly_Income <= 10000.99){
fInterest_Rate = 0.04;

}else if( fWeekly_Income <= 20000.99){


fInterest_Rate = 0.06;
}else {
fInterest_Rate = 0.08;
}
if ( fWeekly_Income<3200){
iPts_Alloted = 0;
}else if ( (fWeekly_Income<7501)){
iPts_Alloted = 110;
}else if( fWeekly_Income <= 10000.99){
iPts_Alloted = 90;
}else if( fWeekly_Income <= 20000.99){
iPts_Alloted = 80;
}else {
iPts_Alloted = 70;
}

fTotal_NHT_Pts = iPts_Alloted + (fYOC*20);


i = fInterest_Rate /12;
n = iLoan_Period /12;
fMortgage_Payment = fLoan_Amt * (( i * pow( 1 + i ,n ))
/ ( pow(1+i,n-1) ));
if( (fMortgage_Payment < fBalance) && ( fTotal_NHT_Pts>=100))
{
strcpy(cApplicant_Stats,"APPROVED");
iApproved_Count = iApproved_Count+1;
}else{
strcpy(cApplicant_Stats,"NOT APPROVED");
}
if( (fMortgage_Payment < fBalance) && (fYOC>=5))
{
strcpy(cQualified_Stats,"QUALIFIED");
}else{
strcpy(cQualified_Stats,"NOT QUALIFIED");

}
printf("\n\n");
printf("APPLICANT LOAN STATUS:\n" "\n");
printf("The Applicant's name is : %s\n", cApplicant_Name);
printf(" Spouse: %s\n", cSpouse);
printf("Applicant's age is: %d years\n", iAge);
printf("Applicant's Gross Salary is: $%.2f\n", fGross_Salary);
printf("Applicant's Total Salary Deduction is: $%.2f\n", fTot_Sal_Deduc);
printf("Applicant's years of contribution is: %.0f years\n", fYOC);
printf("Applicant's Total Expense is: $%.2f\n", fTotal_Expenses);
printf("Applicant Loan Amount is: $%.2f\n", fLoan_Amt);
printf("Applicant's Mortgage payment is $%.2f\n", fMortgage_Payment);
printf("Duration of applicant's loan is %dyears\n", iLoan_Period);
printf("Applicant's Salary Balance is $%.2f\n", fBalance);
printf("Applicant's is %s for a loan.\n", cQualified_Stats);
printf("The Applicant is %s for a loan.\n", cApplicant_Stats);

printf("\nPress Enter to Continue...");


char dummy_pause[233];
scanf("%s",dummy_pause);
}

return 0;
}

Screen-shot of program.

10

Trace Table

Name_
of_
Applicant
Jheneal Gordon
Kerise Swaby
Kerry-Ann Smith
Dania Graham
Therese Lilly
Jeissica Grant
Aldayne Porter
Nordia Samuels
Tremaine McCallum
Phillip Taylor

Housing
Community

Net
Salary

Total
_Expenses

$.00

$.00

Ingleside
Ingleside
Ingleside
Ingleside

10500
18750
30000
21150

8000
15000
25000
19000

Ingleside
Ingleside
Ingleside

29175
70875
87600

25000
60000
3200

Ingleside
Ingleside
Ingleside

39200
70125
17250

3000
65000
15000

NHT_
Points

210
310
390
510
590
670
150
400
270
350

Monthly_
Payment

Balance

$.00

$.00

2220
2251
3339
2587

2500
3750
5000
2150

2600
3345
2425

4175
10875
84400

3610
3860
1844

36200
5125
2250

Applicant_ Applicant_ Approval_


Status
Count
Count

Qualified
Qualified
Qualified
Not
Qualified
Qualified
Qualified
Not
Qualified
Qualified
Qualified
Qualified

1
2
3
4
5
6
7
8
9
10

1
2
3

4
5
6
7
8
9

Years_of_
Contribution

5
10
15
20
25
6
4
16
10
12

Name_ of_
Applicants

Years_
Housing
Community of_

Jheneal
Gordon
Kerise Swaby
Kerry-Ann
Smith
Dania
Graham
Therese Lilly
Jeissica Grant
Aldayne
Porter
Nordia
Samuels
Tremaine
McCallum
Phillip Taylor

Ingleside

Monthly_
Payments

Contribution

Loan_Amount

10

6000000
3500000

15

200

210
310

7000000

300

25
6

3500000
4000000
3500000

2425

2000000

500
120

510
590
190

16

80

6000000

10
12

2000000

6250

110

10000

90

7050

110

94500

9725

90

23625

70

22300

70

400

10150

80

23375

70

5750

110

93500
200

2251

110

40600
320

5000000

38900

150

1844

Ingleside

3500

89200

3860

Ingleside

25000

390

3610
4

Points_Allocated

28200
400

3345

Lo
Weekly_
Income

40000

2600
20

Ingleside

100
3339

Gross _
Salary
14000

2587

Ingleside
Ingleside
Ingleside
Ingleside

NHT_
Points

2251
5

Ingleside
Ingleside

Bonus_
Points

240

270
350

23000

Name of Applicant

Housing
Community

Applicants
Salary
$

Salary
Deductions
$

Spouse
Salary
$

7500

1875

6500

Spouse
Salary
Deductions
$
1625

Ingleside
Ingleside

10000

2500

15000

3750

6250

25000

18750

15000

3750

Kerry-Ann Smith

Ingleside

15000

3750

25000

6250

10000

40000

30000

25000

5000

Dania Graham

Ingleside

25000

6250

3200

800

7050

28200

21150

19000

2150

Therese Lilly

Ingleside

30000

7500

8900

2225

9725

38900

29175

25000

4175

Jeissica Grant

Ingleside

90000

22500

4500

1125

23625

94500

70875

60000

10875

Aldayne Porter

Ingleside

86000

21500

3200

800

1600

89200

87600

3200

84400

Nordia Samuels

Ingleside

40000

10000

600

150

1400

40600

39200

3000

36200

Tremaine McCallum

Ingleside

85000

21250

8500

2125

23375

93500

70125

65000

5125

Phillip Taylor

Ingleside

12000

3000

11000

2750

5750

23000

17250

15000

2250

Jheneal Gordon
Kerise Swaby

Total
Salary
Deductions
$
3500

Gross
Income
$

Net
Income
$

Total
Expenses
$

Balance
$

14000

10500

8000

2500

The Department of Communication and Information Technology

Certification of Authorship of work

Submitted to: Mr. Adrian Vanhorne


Students Name:
Date of Submission: May 18, 2015
Purpose and Title of Submission:

Certification of Authorship: I hereby certify that I am the author of this document and that any
assistance I received in its preparation is fully acknowledged and disclosed in the document. I
have also cited all sources from which I obtained data, ideas, or words that are copied directly or
paraphrased in the document. Sources are properly credited according to accepted standards for
professional publications. I also certify that this paper was prepared by me for this purpose.

Student's Signature:________________________________________________________