31.5k views
3 votes
Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the customer's loan balance each month until the loan is paid off. b. Modify the Bob's E-Z Loans application so that after the payment is made each month, a finance charge of 1 percent is added to the balance.

User Belens
by
5.9k points

1 Answer

6 votes

Answer:

part (a).

The program in cpp is given below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

//variables to hold balance and monthly payment amounts

double balance;

double payment;

//user enters balance and monthly payment amounts

std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;

std::cout << "Enter the balance amount: ";

cin>>balance;

std::cout << "Enter the monthly payment: ";

cin>>payment;

std::cout << "Loan balance: " <<" "<< "Monthly payment: "<< std::endl;

//balance amount and monthly payment computed

while(balance>0)

{

if(balance<payment)

{ payment = balance;}

else

{

std::cout << balance <<"\t\t\t"<< payment << std::endl;

balance = balance - payment;

}

}

return 0;

}

part (b).

The modified program from part (a), is given below.

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

//variables to hold balance and monthly payment amounts

double balance;

double payment;

double charge=0.01;

//user enters balance and monthly payment amounts

std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;

std::cout << "Enter the balance amount: ";

cin>>balance;

std::cout << "Enter the monthly payment: ";

cin>>payment;

balance = balance +( balance*charge );

std::cout << "Loan balance with 1% finance charge: " <<" "<< "Monthly payment: "<< std::endl;

//balance amount and monthly payment computed

while(balance>payment)

{

std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;

balance = balance +( balance*charge );

balance = balance - payment;

}

if(balance<payment)

{ payment = balance;}

std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;

return 0;

}

Step-by-step explanation:

1. The variables to hold the loan balance and the monthly payment are declared as double.

2. The program asks the user to enter the loan balance and monthly payment respectively which are stored in the declared variables.

3. Inside a while loop, the loan balance and monthly payment for each month is computed with and without finance charges in part (a) and part (b) respectively.

4. The computed values are displayed for each month till the loan balance becomes zero.

5. The output for both part (a) and part (b) are attached as images.

Design an application for Bob's E-Z Loans. The application accepts a client's loan-example-1
Design an application for Bob's E-Z Loans. The application accepts a client's loan-example-2
User Vinay Sharma
by
6.5k points