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 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest = averageDailyBalance * 0.0152  Instructions Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate). The program outputs the interest. Format your output to two decimal places.   Input: 100 30 50 7 9.7 Output: 856.83     Test case 2: Input: 255.76 31 55 3 12.3 output: 3080.38

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
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

If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is:

interest = averageDailyBalance * 0.0152 

Instructions

Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate).

The program outputs the interest.

Format your output to two decimal places.

 

Input:

100

30

50

7

9.7

Output:

856.83

 

 

Test case 2:

Input:

255.76

31

55

3

12.3

output:

3080.38
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning