Question

In: Computer Science

‘A Home For You’ is a company that provides financing for purchasing a home. All mortgage...

‘A Home For You’ is a company that provides financing for purchasing a home. All mortgage
applicants must first be approved. All approved applicants are then required to make a deposit on the
home loan to cover the various applicable fees. The following information is entered for each
applicant:
 name
 loan amount
 age (A valid age is between 18 and 55 inclusive)
 monthly income (monthly income > 0 )
 credit rating ('G' for good and 'B' for bad)
 house owner (True if applicant owns home and False otherwise)
 Permanent job. (True if applicant has a permanent job and False otherwise)
The following conditions are used to process the mortgage application:
 Invalid age or income will result in the mortgage application being denied.
 Everybody in the appropriate age range and with good credit will have their application
approved.
 For those with a valid age and income and with bad credit rating, their application will
be approved if they own their own house AND have a permanent job OR if they have a permanent job AND their monthly income is 3 times or greater than the mortgage
amount.
 The following schedule is used to determine the required deposit for approved loan
applications:
Loan Amount ($) Deposit
Less than $25,000 5% of loan amount
$25,000 - $49,999 $1,250 + 10% of loan amount
$50,000 – 100,000 $5,000 + 25% of loan amount
Loans in excess of $100,000 are not allowed.


Write a program, using C, which will process the loan application for FIVE (5) applicants. The
program should first determine whether the loan is approved and then determine the required deposit
if the loan has been approved. The output should be the applicant’s name, the loan amount and the
required deposit or an appropriate message if the loan has been denied.
NB: Display the total number of approved and total number of unapproved loans.

Solutions

Expert Solution

The Code for the program is given below.

main.c

#include <string.h>
#include <stdio.h>
#include <stdbool.h>

float calcDepo(int loanAmount)
{
float amt=0;
if(loanAmount<=25000)
{
return (loanAmount * 0.05);
}
else
if(loanAmount>25000 && loanAmount<= 49999)
{
amt = loanAmount * 0.10;
amt += 1250;   
}
else
if(loanAmount>=50000 && loanAmount<= 100000)
{
amt = loanAmount * 0.25;
amt += 5000;   
}
}

int main()
{
bool arr[2] = {false, true};
int count=0,passed=0,rejected=0;
int loanAmt,age,income,house,job;
float depo=0;
char rating[2],ratG[] = "G",ratB[] = "B",name[30];
while(count<5)
{
printf("Enter details : \n");
printf("Name : ");
scanf("%s",name);
  
printf("Loan Amount: ");
scanf("%d",&loanAmt);
  
printf("Age : ");
scanf("%d",&age);
  
printf("Monthly Income : ");
scanf("%d",&income);
  
printf("Credit Rating : ");
scanf("%s",rating);
  
printf("House Owner 1=true , 0 = false: ");
scanf("%d",&house);
  
printf("Permanent job 1= true, 0 = false ");
scanf("%d",&job);
  
  
if((age >= 18 && age <= 55) && (income >0))
{
if(loanAmt < 100000)
{
depo = calcDepo(loanAmt);

if(strcmp(rating,ratG)==0)
{
passed++;
printf("\n\n");
printf("Name : %s",name);
printf("\nLoan Amount : %d ",loanAmt);
printf("\nDeposit %.2f",depo);
printf("\nApproved\n\n");
}
else
if(strcmp(rating,ratB)==0)
{
if((house == 1 && job == 1) || (job == 1 && income >= (3 * loanAmt) ))
{
passed++;
printf("\n\n");
printf("Name : %s",name);
printf("\nLoan Amount : %d ",loanAmt);
printf("\nDeposit %.2f",depo);
printf("\nApproved\n\n");
}
else
{
printf("Application Rejected !");
rejected++;
printf("\n\n");
}
}
  

}
else
{
printf("Application Rejected !");
rejected++;
printf("\n\n");
}
  
}
else
{
printf("Application Rejected !");
rejected++;
printf("\n\n");
}
  
count++;
}
  
printf("\n \n \nTotal Passed %d",passed);
printf("\nTotal Rejected %d",rejected);
  
return 0;
}

Output


Related Solutions

You are purchasing a single family home for $374,000.    Your mortgage company is offering you a...
You are purchasing a single family home for $374,000.    Your mortgage company is offering you a rate of 4.15% compounded monthly for a term of 30 years. Use a TVM Calculator to determine your monthly payment. Please show the values you entered into the TVM Calculator. Present Value =                                                           Payments            = Future Value      = Annual Rate% = Periods               = Compounding   =
Suppose that you plan on purchasing a home and you are offered the following financing options....
Suppose that you plan on purchasing a home and you are offered the following financing options. (1) Annual interest rate of 6%, with additional upfront fees of $20,000 (These fees are not included in the $300,000 you will be financing, they will be paid upfront in cash). (2) Annual interest rate of 7% with additional upfront fees of $2,000 (also will not be financed, will be paid upfront in cash). You will make monthly payments for 30 years and you...
You are considering purchasing a home that requires $300,000 mortgage at 5.25%. The payment on the...
You are considering purchasing a home that requires $300,000 mortgage at 5.25%. The payment on the 30 year mortgage for this amount is $1656.61 per month, the payment for a 15 year maturity is $2411.63 per month. A) What is the total amount that you would pay for the 30 year mortgage, including interest? B) What is the total amount that you would pay for the 15 year mortgage, including interest? C) What is the difference in the total interest...
You are purchasing a new home and need to borrow $325,000 from a mortgage lender. The...
You are purchasing a new home and need to borrow $325,000 from a mortgage lender. The lender quotes a rate of 6.5% APR for a 30-year fixed rate mortgage (with payments made at the end of each month). The lender offers you the option to "buy down" the interest rate. If you pay 1 point, the interest rate will be reduced to 6.25% APR for a 30year fixed rate mortgage. One point is equal to 1% of the loan value....
You are interested in purchasing the Malibu home (sale price of $12,000,000, mortgage rate of 3.955%,...
You are interested in purchasing the Malibu home (sale price of $12,000,000, mortgage rate of 3.955%, 30% down payment, 30 year fixed mortgage). How much principal would you pay                             [ Select ]                       ["$25,646", "$12,240", "$25,158", "$12,816"]         during month 2? How much would your monthly payment go up today                            [ Select ]             ...
You and your spouse are considering purchasing a home. The home you are purchasing is $231,250....
You and your spouse are considering purchasing a home. The home you are purchasing is $231,250. You plan on offering full price today. You have a 10% down payment and your are financing the remaining balance for 30 years. (Round off the amount you are financing to nearest dollar.) You have checked with several lenders and find the best rate to be 4.5% for 30 years. In order to qualify for the loan the lender tells you that your front...
You are purchasing a house and your bank is giving you a special mortgage that will...
You are purchasing a house and your bank is giving you a special mortgage that will require annual payments for 25 years. The amount borrowed now is $350,000 and the first mortgage payment will be in one year. a. Using C as the payment​ amount, indicate on a timeline all of the cash flows from your perspective related to this mortgage​ (outflows should be indicated as a negative​ number). b. What will your payments be if the interest rate is...
. The mean monthly mortgage paid by all home owners in a town is $2365 with...
. The mean monthly mortgage paid by all home owners in a town is $2365 with a standard deviation of $340. Use Chebyshev’s Theorem to find the following quantities. (a) (2 points) The minimum percentage of all home owners in this town who pay a monthly mortgage of $1685 to $3045. (b) (3 points) The interval that contains the monthly mortgage pay- ments of at least %84 of all home owners in this town.
You are financing a new home. The loan is for $173,000 and you are getting rate...
You are financing a new home. The loan is for $173,000 and you are getting rate of 3.8% per year compounded monthly. You have decided on a 15 year mortgage and will make monthly payments (end of the month). To get the ball rollng, you are working extra hours and expect to pay an extra $300 per month to knock down the principle. You make these payments for 3 years starting on month 1. The last payment is on month...
In purchasing a house that is worth $175,000, you need to obtain a mortgage. Suppose you...
In purchasing a house that is worth $175,000, you need to obtain a mortgage. Suppose you choose a 30year fixed rate mortgage with an interest rate/year of 9.74%. What is the annual payment required? How much of each year's payment goes to paying interest and how much to reducing the principal balance for the first 15 years?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT