Interest on a credit card’s unpaid balance is calculated using the average daily
ID: 667806 • Letter: I
Question
Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 - payment * d2) / d1. The interest on the unpaid balance is: interest = averageDailyBalance * interestRate where interestRate is the interest rate per month. Write a program that accepts as input netBalance, payment, d1, d2, and interestRate. The program outputs the interest. Format your output to two decimal places. Analyze and design this program. Write the code, compile and run it. Upload your analysis and design document and your .cpp source code file here. Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 - payment * d2) / d1. The interest on the unpaid balance is: interest = averageDailyBalance * interestRate where interestRate is the interest rate per month. Write a program that accepts as input netBalance, payment, d1, d2, and interestRate. The program outputs the interest. Format your output to two decimal places. Analyze and design this program. Write the code, compile and run it. Upload your analysis and design document and your .cpp source code file here. Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 - payment * d2) / d1. The interest on the unpaid balance is: interest = averageDailyBalance * interestRate where interestRate is the interest rate per month. Write a program that accepts as input netBalance, payment, d1, d2, and interestRate. The program outputs the interest. Format your output to two decimal places. Analyze and design this program. Write the code, compile and run it. Upload your analysis and design document and your .cpp source code file here.Explanation / Answer
Analysis:
ii) Processes required:
iii)Expected Outputs:
Design:
Algorithm:
Step 1: Read inputs netBalance, payment, interestRate, d1 and d2 from user
Step 2: Calculate averageDailyBalance = (netBalance * d1 - payment * d2) / d1.
Step 3: Calculate interest = averageDailyBalance * interestRate
Step 4: Display interest
Program:
// creditCard.cpp
using namespace std;
#include <iostream>
#include <iomanip>
int main()
{
float averageDailyBalance, netBalance, payment,interest, interestRate;
int d1, d2;
cout<<" Enter the Net Balance ( Balance shown in bill):";
cin>>netBalance;
cout<<" Enter the Payment made:";
cin>>payment;
cout<<" Enter the number of days in the billing cycle:";
cin>>d1;
cout<<" Enter the number of days payment is made before billing cycle:";
cin>>d2;
cout<<" Enter the Interest rate:";
cin>>interestRate;
averageDailyBalance = (netBalance * d1 - payment * d2) / d1;
interest = averageDailyBalance * interestRate;
cout<<" The Interest on unpaid balance is:"<<setprecision(2)<<interest;
return 0;
}
Output:
Enter the Net Balance ( Balance shown in bill):2800
Enter the Payment made:200
Enter the number of days in the billing cycle:25
Enter the number of days payment is made before billing cycle:5
Enter the Interest rate:6
The Interest on unpaid balance is:1.7e+004
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.