Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you solve this problem in programming language BASH? You will implement a simple mortgage calculator. The goal is to compute the average monthly payment

Can you solve this problem in programming language BASH? image text in transcribed
image text in transcribed
You will implement a simple mortgage calculator. The goal is to compute the average monthly payment so a user can assess if they can afford the minimum monthly payments. Consider that you would like to apply for a 30-year fixed loan amount of $300,000 at an annualized interest rate of 5.75%. Your mortgage calculator should be able to compute the monthly payment up to two decimal places. Here is a formula A that you should use: MonthlyPayment=Principal[InterestRate((1+InterestRate)NumMonths)]/[((1+InterestRate)NumMonths)1] where - Principal is the principal amount. - InterestRate is the normalized percent interest per month. So if the APR or annualized percentage rate is 5.75%, the normalized percent interest per month would be 5.75/(10012)=.004791. - NumMonths is the number of months over the period of loan. So if the period of loan is 30 years, we get 3012=360 monthly payments. 3012=360 monthly payments. Function Description Complete the function mort calc in the editor below. Given the loan amount, annual interest and period of loan in years, you need to calculate the monthly payment. The loan amount is the Principal. The annual interest can be converted into normalized percent interest per month (InterestRate) as mentioned above. And the NumMonthlyPayments are obtained by multiplying the loan period by 12 . Note that you can use bc (basic calculator) to perform calculations with a given scale. For instance: int ="$( echo "scale=6; 2.75/(10012)"bcq)" the above will pipe an arithmetic expression that allows us to divide annual interest 2.75 by (10012) in order to get the normalized monthly percentage. And then you can use this interest rate using the MonthlyPayment formula A mentioned above, along with the principal amount, and computed NumMonths to generate another arithmetic expression that you can process again using bc. Again, you can use bc to compute NumMonths. Finally in order to truncate to two decimal places, you can various options

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago