Based on the loan application records of a bank and the example of query, write a program that determines whether a loan applicant is to be approved or disapproved his/her loan application. Criteria of an application to be considered are assets, income and the loan value. Applicant with assets > income and loan value =< assets will be approved the loan, meanwhile those who do not meet the condition will not be approved. The program will terminate as user typed in “exit”.
Facts:
applicant(david,dav123).
applicant(sarah,sar123).
applicant(kamal,kam123).
applicant(siti,sit123).
assets(dav123,20000).
assets(sar123,5000).
assets(kam123,660).
assets(sit123,5000).
income(dav123,1000).
income(sar123,2350).
income(kam123,1500).
income(sit123,3000).
Example query (expected output):
?- start.
Enter Applicant ID : 123dav.
Enter Loan Value : 4000.
Loan application by david is approved
Enter Applicant ID : 123sar.
Enter Loan Value : 10000.
Loan application by sarah is not approved
Enter Applicant ID : 123sit.
Enter Loan Value : 5000.
Loan application by siti is approved
Enter Applicant ID : exit.
Exiting program... Thank you