Question

In: Computer Science

In python please 6.12 Mortgage Example A mortgage company is interested in automating their decision-making process....

In python please

6.12 Mortgage Example

A mortgage company is interested in automating their decision-making process.

As part of this automation, they are looking for a software that takes a set of information from each customer and identify

1) if a customer is eligible to apply for a mortgage

2) if a customer is qualified to get the mortgage of the requested amount,

eligibility criteria:

1. the applicant should be 19 or over 19 years old

2. the applicant should be the resident of that country (in the beginning assume that the applicant needs to be a resident of U.S.)

qualification criteria

1. the applicant should be eligible

2. the difference between the applicant's monthly income and applicant's monthly expenses should be greater than the mortgage monthly payments

Considering the code in the template, complete the code so that it prints; 1) if the user is eligible 2) the amount of monthly mortgage payment for the requested amount of mortgage with a specific interest rate taken from input and specific amount of time (in years) to pay off the mortgage, and 3) if the used is qualified

Hint: use this formula to calculate the monthly mortgage payment: (RequestedMortgageAmount + (RequestedMortgageAmount * overallinterestrate)) / (years * 12)

please consider 15%, 20% and 24% overall interest rate for pay offs in 10, 15, and 30 years, respectively. Round down the monthly mortgage payment using int() function.

Fix the mortgagemonthlypayment function and then call it in the main program with appropriate inputs.

Given code:

# we define four functions; eligible(), difference_btw_incomeAndexpense(), mortgae_monthly_payment() and qualify()
# reminder: each function is like a template and it does not run unless we call it with appropriate set of input values

# This function takes applicant's age and country of residence and return a boolean variable;if True meaning that the applicant is eligible
def eligible(age, country_of_residence):
elig = False
if (age >= 19) and (country_of_residence == 'USA'):
elig = True
return elig


# This function takes the family income value and all expenses and calculate the difference btw them and return the difference
def difference_btw_incomeAndexpense(family_income, loan_payments, educations_payment, groceryAndfood, others):
diff = family_income - (loan_payments + educations_payment + groceryAndfood + others)
return diff

# This function takes the user requested amount of mortgage and applies an interest rate to it and calculates the monthly payment amount
# This function applies 20% overall interest rate over 15 years
# you can make changes to this function and make it closer to what happens in reality. How ????????????????????
#def mortgage_monthly_payment(RequestedMortgageAmount):
# m_p = (RequestedMortgageAmount + (RequestedMortgageAmount * 0.2)) / (15 * 12)
# return m_p

def mortgage_monthly_payment(RequestedMortgageAmount, years):
#### FIX ME

# This function takes the output of the last two function and the amount of mortgage monthly payments and return if the applicant is qualified or not
def qualify(elig, diff, mortgage_monthly_payment):
qual = False
if (elig == True) and (diff > mortgage_monthly_payment):
qual = True
return qual
  
  
# the main program

# sometimes, we write a function and we want to use that in other Python scripts as a module.
# In this example, we want to use all three functions in the current program (script)
# the following if statement is used to tell Python that we want to use the above-defined functions in the current Python script.
if __name__ == "__main__":
  
print('please enter your age:')
age = int(input())
  
print('Please enter the country of residence. If you are a resident of the United States enter USA:')
country = input()
  
family_income = int(input('Please enter your family total monthly income:'))
  
loan_payment = int(input('Please enter your family amount of monthly loan payment:'))
  
edu = int(input('Please enter an estimate of your family amount of monthly education payment:'))
  
groceryAndfood = int(input('Please enter your family amount of monthly grocery and food expenses:'))
  
others = int(input('Please enter the amount of other expenses not listed above:'))
  
requested_mortgage_amount = int(input('Please enter the amount of the mortgage you arerequesting:'))

####### COOMPLETE ME

# we call eligible() function
# we keep the result of eligible() function in variable E and then test E using a conditional statement to print eligible or not eligible
E = eligible(age, country)
  
if E == True:
print('you are eligible')
else:
print('you are not eligible')

# calling difference_btw_incomeAndexpense() function and keeping its outcome in Difference variable so that we can use it later on when we call qualify() function
Difference = difference_btw_incomeAndexpense(family_income, loan_payment, edu, groceryAndfood, others)

# calling mortgage_monthly_paymenr() function and keeping its outcome in Mortgage_m_p variable to be used in qualify() function later on
# fixme

  
# calling qualify() function using the outputs of eligible(), E, the output of diff(), Difference, and the output of mortgage_monthly_payment(), Mortgae_m_p
Qual = qualify(E, Difference, Mortgage_m_p)

# since Qual is either True or Fasle, we want to use it to print a stetement to tell the user if they are qualified or not
if Qual == True:
print('you are qualified')
else:
print('you are not qualified')

Solutions

Expert Solution

I hope this works:

continued...

calling the function:

If a user is not eligible, we can end the program at that time, no need to take further inputs.

If the user is eligible, we have taken further inputs and calculated as required.

That's all.


Related Solutions

​The Money Pit Mortgage Company is interested in monitoring the performance of the mortgage process.
The Money Pit Mortgage Company is interested in monitoring the performance of the mortgage process. Fifteen samples of five completed mortgage transactions each were taken during a period when the process was believed to be in control. The times to complete the transactions were measured. The means and ranges of the mortgage process transaction times, measured in days, are as follows: Sample123456789101112131415Mean201610191415171815161811131114Range6103781211149911581012Subsequently, samples of size 5 were taken from the process every week for the next 10 weeks. The times were...
Using an example of each, expalin the key differences in the consumer decision making process between...
Using an example of each, expalin the key differences in the consumer decision making process between a product or service from both high and low involvement categories?
please no hand writing Q 4     Making a decision to process a product further is not...
please no hand writing Q 4     Making a decision to process a product further is not influenced by joint cost allocation. However, it should be based on incremental costs and qualitative factors. Discuss this statement.
Hello, please solve it with Example. Thank you. apply the terminology of decision making to describe...
Hello, please solve it with Example. Thank you. apply the terminology of decision making to describe business problems compare and contrast deterministic and probabilistic models Action Items Using the definitions found in Chapter 1 of Quantitative Analysis, the Internet, and your own personal experiences, make notes on and post one example of each of the following to the class Discussion Board topic "Deterministic and Probabilistic Models". A deterministic model; A probabilistic model; and A situation in which you could use...
Can someone please provide an example of Apple's decision-making(in your own words)?
Can someone please provide an example of Apple's decision-making(in your own words)?
Using the data from your organization, identify an example where the quantitative process of “decision making...
Using the data from your organization, identify an example where the quantitative process of “decision making under uncertainty” could assist with a decision. a)      Define the states of nature and estimate probabilities for each state of nature. b)      Organize data in a payoff table. c)      Determine the expected payoff of each alternative. d)     Determine the best alternative. e)      Calculate the value of perfect information.
Decision making can be viewed as an eight-step process, use these steps in making any decision....
Decision making can be viewed as an eight-step process, use these steps in making any decision. Please use your own example and do not take the examples from the PowerPoint presentation (buying a car or a computer)
What are the steps in the consumer decision making process
What are the steps in the consumer decision making process
Explain the WH process of ethical decision-making.
Explain the WH process of ethical decision-making.
What is the decision making process at Nike like?
What is the decision making process at Nike like?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT