Instructions +main.cpp 1#include Summary Interest on a credit cards unpaid balan
ID: 3887575 • Letter: I
Question
Instructions +main.cpp 1#include Summary Interest on a credit cards unpaid balance is calculated using the average daily balance. 3 using nanespace std: int main) 6/ Write your main here Suppose that netBalance is the balance shown in the bill, payment is the payment made, ds is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. return 0 Then, the average daily balance is: averageDailyBalance = (netBalance . dl - payment . d2) / dl If the interest rate per month is, say. 0.0152, then the interest on the unpaid balance is: | interest = averageDailyBalance · 6.0152 Instructions Write a program that accepts as input netBalance.d1 paynent. d2 .and interest rate per month(interestRate ). The program outputs the interest. Format your output to two decimal places.Explanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int d1, d2;
double interestRate, payment, netBalance;
cout << "Enter the net balance: ";
cin >> netBalance;
cout<<"Enter the day 1: ";
cin >> d1;
cout<<"Enter the payment: ";
cin >> payment;
cout<<"Enter the day 2: ";
cin >> d2;
cout<<"Enter the interest rate: ";
cin >> interestRate;
double averageDailyBalancce = (netBalance*d1 - payment*d2)/d1;
double interest = averageDailyBalancce * interestRate;
cout<<fixed<<setprecision(2)<<"The interest on unpaid balance is "<<interest<<endl;
return 0;
}
Output: