Using COBOL: Write an interactive program (no environment division) to accept in
ID: 3667877 • Letter: U
Question
Using COBOL: Write an interactive program (no environment division) to accept input from the keyboard that specifies for each borrower the amount that he or she wishes to borrow along with the price at which the house is valued.
The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows:
4% of the first $60,000 borrowed 8% of the next $30,000 borrowed 10% of the rest
The amount borrowed cannot exceed 50% of the value of the house.
Based on the data entered, display the following:
1. A message that indicates if the amount the user wishes to borrow is acceptable (no more than 50% of the house value).
2. A message that indicates if the value of the house is acceptable (does not exceed $500,000).
3. A message displaying the required down payment, if the amount to be borrowed is acceptable. When the amount to be borrowed is not acceptable, the program must not calculate or display the required down payment.
Explanation / Answer
//Calculating Loan Amount from Bank
PROGRAM-ID .HELLO.
BANKLOAN
WORKING -STORAGE SECTION
01 CUSTOMERNAME PIC 9(9)
01 WHICHBANK PIC 9(9)
01 LOANAMOUNT PIC 9(9)
01 TOTALAMOUNT PIC9(9)
O1 CALCULATEDAMOUNT PIC 9(9)
PROCEDURE BANKLOAN
ACCEPT CUSTOMERNAME.
ACCEPT WHICHBANK.
ACCEPT LOANAMOUNT.
ACCEPT VALUEOFHOUSE
IF TOTALAMOUNT <=500000 THEN
CALCULATEDAMOUNT=(TOTALAMOUNT-LOANAMOUNT)*
(4/100)+(TOTALAMOUNT-LOANAMOUNT)*(8/10)+(TOTALAMOUNT-LOANAMOUNT)*
(10/100)
DISPLAY 'THE VALUE OF HOUSE IS ACCEPTED'
DISPLAY 'CALCULATED AMOUNT IS LESS THAN 5000000'.
ELSE
DISPLAY 'NOT ACCEPTABLE LOAN AMOUNT'
DISPLAY CUSTOMERNAME.
DISPLAY WHICHBANK
DISPLAY LOANAMOUNT
DISPLAY VALUEOFHOUSE
STOP RUN
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.