In this lab you will determine whether a customer qualifies for a loan. You will
ID: 3706086 • Letter: I
Question
In this lab you will determine whether a customer qualifies for a loan. You will use boolean variables as flags to indicate qualification conditions, and if the right combination of lags is true, the customer will qualify. Boolean variables can be set the long way or the short way. For example, given boolean variable hasMiddleName, you can set it the long way with something like: if (middleName.length) > 0) f hasMiddeName true; else f hasMiddleName false; The short way uses the same boolean expression as above: hasMiddleName (middleName.lengthO > 0); Use the short way throughout the program to set boolean variables. Below are the partial program specifications. You will fill in the rest of the program with knowledge gained from the previous labs. 1. Declare boolean variables hasGoodCredit, hasEnoughIncome, and hasLovDebt. You will declare additional boolean variables to handle some of the conditions described below. 2. On the comsole, anmouno the progrnam and wh 3. Prompt the user for a customer's name, requested loan amount, credit rating, annual income and the total amount of the customer's current debt. Assume that all four of these quantities are integers.Explanation / Answer
Java program for qualifying customers for loan
==============
import java.util.*;
class Dcoder
{
public static void main(String args[])
{
boolean hasGoodCredit, hasEnoughIncome, hasLowDebt;
int credit=700, income=75000, debt=10000;
Scanner sc=new Scanner(System.in);
System.out.println("Enter customer name: ");
String customer_name=sc.next();
System.out.println("Enter loan Amount: ");
int loanAmount =sc.nextInt();
System.out.println("Enter credit Rating : ");
int creditRating =sc.nextInt();
System.out.println("Enter annual income : ");
int annualIncome =sc.nextInt();
System.out.println("Enter current Debt : ");
int currentDebt =sc.nextInt();
boolean qualifiedForLoan = false,cond1,cond2,cond3;
hasGoodCredit = (creditRating >700);
hasEnoughIncome =(annualIncome >=75000);
hasLowDebt = (currentDebt <= 10000);
cond1 = hasGoodCredit && hasEnoughIncome && hasLowDebt ;
cond2 = (!hasLowDebt ) && (annualIncome > 2*loanAmount );
cond3 = (!hasEnoughIncome ) && (creditRating >=750);
qualifiedForLoan =cond1 || cond2 || cond3 ;
}
}
============
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.