In this lab you will determine whether a customer qualifies for a loan. You will
ID: 3725202 • 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 flags 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) hasMiddeName true ; else hasMiddleName = false; The short way uses the same boolean expression as above: hasMiddleName = (middleName. length() > 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 hasLozDebt. You will declare additional boolean variables to handle some of the conditions described below. 2. On the console, announce the program and what it does. 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
#include <iostream>
using namespace std;
int main()
{
bool hasGoodCredit, hasEnoughIncome, hasLowDebt, qualified;
int loan_amt, credit_rating, annual_income, current_debt;
string cname;
//Prompt the user for
cin>>cname; //customer_name
cin>>loan_amt; //requested_loan_amount
cin>>credit_rating; //credit_rating
cin>>annual_income; //annual_income
cin>>current_debt; //current_debt
hasGoodCredit = (credit_rating > 700); //short way to check //creidtscore
hasEnoughIncome = (annual_income>150000); //short way to check //EnoughIncome
hasLowDebt = (current_debt > 500);//short way to check for low //Debt
qualified = (hasGoodCredit == true && hasEnoughIncome ==true && hasLowDebt == true);
//short way to check wheather customer qualified for loan
//Long way to check wheather customer quaified or not
if(qualified == true)
cout<<"Qualified for loan";
else
cout<<"Not qualified for loan";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.