Write a C++ program that calculates and determines a customer\'s loan status for
ID: 3571279 • Letter: W
Question
Write a C++ program that calculates and determines a customer's loan status for a bank. The program should accept as input the customer's id number, checking account balance, and savings accounts balance. The program should print the customer's id number and the status of their loan. If the checking account balance is greater than or equal to $500. and if the savings account balance is greater than or equal to $500, the Loan is APPROVED. If the checking account balance is less than $500, and the savings account balance is greater than or equal to $500. the loan is CONDITIONALLY APPROVED. If the checking account balance is less than $500, and if the savings account balance is less than $500, the Loan is REJECTED. Write an interactive C++ program that inputs from the user the length and width of a rectangle. Please use an appropriate input prompt. The program should calculate and print the area of the rectangle, the perimeter of the rectangle, and the length of the diagonal of the rectangle. Use the Pythagorean theorem to determine the length of the rectangle. Print all numbers to 3 decimal places. Formulas area = length * width perimeter = 2*length + 2 * width Pythagorean theorem = a^2 + b^2 = c^2Explanation / Answer
1.Loan question solution:
#include <iostream>
using namespace std;
int main()
{
int customer_id;
//variable to take customer id
float checking_account_balance;
//variable for checking accouht balance
float savings_account_balance;
//variable for savings account balance
cout << "Please enter the customer id" << endl;
cin>>customer_id;
cout<<customer_id<<endl;
cout<<"Please enter the checkings account balance in dollars"<<endl;
cin>>checking_account_balance;
cout<<"Please enter the savings account balance in dollars"<<endl;
cin>>savings_account_balance;
if(checking_account_balance >= 500 && savings_account_balance >=500)
{
cout<<customer_id<<" "<<"APPROVED" ;
}else if(checking_account_balance < 500 && savings_account_balance >=500)
{
cout<<customer_id<<" "<<"CONDITIONALLY APPROVED";
}else if(checking_account_balance < 500 && savings_account_balance <500){
cout<<customer_id<<" "<<"REJECTED";
}
return 0;
}
//Note we had to use else if in all three cases because there is no mention when checking account balance >500 and savings account balance is less than 500.
2. Rectangle Question:
#include <iostream>
#include<math.h>
#include<iomanip>
//We have used iomanip for precision function and math for some predefined functions like sqrt as shown below.
using namespace std;
int main()
{
double length;
double breadth;
cout << "Please enter the length of the rectangle" << endl;
cin>>length;
//input the length of the rectangle
//cout<<customer_id<<endl;
cout<<"Please enter the width of the rectangle"<<endl;
cin>>breadth;
//input the width of the rectangle
double area,perimeter,diagonal_length;
//create three variables for area,perimeter and diagonal respectively as shown in the above line
area=length*breadth;
//calculate and store area in the area named variable
perimeter=2*(length+breadth);
//calculate and store perimeter in the perimeter named variable
diagonal_length=sqrt((length*length)+(breadth*breadth));
//calculate and store length of the diagonal using the pythagoras formula in the diagonal_length named variable
//print the three variable with maximum three decimal places which is achieved using fixed and setprecision(3) cout<<"The area is"<<fixed << setprecision(3)<< " "<< area <<endl;
cout<<"The area is"<<fixed <<setprecision(3)<< " "<<perimeter <<endl;
cout<<"The area is"<<fixed <<setprecision(3)<< " "<<diagonal_length <<endl;
return 0;
}
Thanks a lot for the question. Please do let me know in case of any doubt in either of the question. :) ;)...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.