Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c++ programming format please et.UM p 12 2018 1. How long ill it take to pay off

ID: 3705492 • Letter: C

Question

c++ programming format please

et.UM p 12 2018 1. How long ill it take to pay off a credit card balance if you just keep paying the minimu required monthly payment? Write a program that generates a monthly and an annual summary of transactions on a credit card loan. The summary should include starting balance current balance, interest paid in the period that just ended, and the cumulative interest paid. Write the summary to the file your name a13-1-out.dat. Let the user input the balance, the interest rate, and the minimum required monthly payment. The interest rate will be entered in annual percentage form. For example an APR of 6.25% will be entered as 6.25. The interest will compound monthly. Account for the situations where a loan never ends The program will be graded based on: -correct and complete functioning, the form and readability of the code, and the presentation of the output 80% 5% 15% RNEW 303, Software Engineering S18RNEW303APRO5 Spring 2018 Page 1 of 1

Explanation / Answer

#include<iostream>
#include <fstream>
using namespace std;

int main()
{
float balance,annual_rate,monthly_amount,monthly_rate;
float total_interest_paid = 0,interest = 0;
int months_count = 0;
float payable_amount;
cout<<"Enter Balance :";
cin >> balance;
cout<<"Enter Interest rate :";
cin >> annual_rate;
cout<<"Enter Minimum required monthly payment :"; // if this input will be given for every month , move this and next line into while loop and place them before if statement
cin >> monthly_amount;
monthly_rate = annual_rate / 12; // to calculate per month interest rate
ofstream outfile;
outfile.open("name-a13-1-out.dat",ios::out); // change the name to your name
payable_amount = balance;
if (payable_amount == 0)
{
outfile << "starting balance : "<< payable_amount << endl;
outfile << "current balance : "<< payable_amount << endl;
outfile << "interest paid in the current month : "<< interest << endl;
outfile << "cumulative interest paid : "<< total_interest_paid << endl;   
}
else
{
while(payable_amount > 0)
{
interest = float(payable_amount * monthly_rate); //calculate interest based on amount to be paid
payable_amount = payable_amount + interest;
total_interest_paid += interest;
outfile << "starting balance : "<< payable_amount << endl;
if (payable_amount > monthly_amount)
{
payable_amount -= monthly_amount;   
}
else
{
payable_amount = 0;
}
outfile << "current balance : "<< payable_amount << endl;
outfile << "interest paid in the current month : "<< interest << endl;
outfile << "cumulative interest paid : "<< total_interest_paid << endl;
months_count += 1;
}
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote