#include <iostream.h>
main(){
int balance;
int payment;
int payment_num = 1;
int months = 0;
float interest;
cout << "Please input a value for the balance" << endl;
cin >> balance;
cout << "Please input a value for the payment" << endl;
cin >> payment;
while (balance > 0)
{
if (balance <= 5000){
interest = .13 * balance;
}
if (balance >= 5001 || <= 10000){
interest = .18 * balance;
}
if (balance > 10000){
interest = .21 * balance;
}
balance = balance + interest - payment;
payment_num++;
months++;
cout << "After" << payment_num << "Payments your balance is:" << balance
<< endl;
}
cout << "It took you" << months << "to pay off your debt" <end;
}
Just I'm brand new to this community and I've been coding HTML/CSS for years. However, I'm taking a basic computer science class and I'm really struggling with C. I was instructed to create a program that will do the following:
You need to pay off credit card debt following a lengthy stay in college. You need to input a balance of what your loans total to and the payment amount you think you can make each month.
APR rates are
Balance APR
$1-$5000 13%
$5001-$10000 18%
> $10000 21%
In this assignment, you will write a program that will determine the number of months it will take you to pay off your debt.
New balance is equal to the previous balance plus the monthly interest minus the payment amount.
Output the payment number (payment_num) and the remaining balance after each payment until the debt is paid off. Use endl so that it will be easy to read on the screen. The output statement should be inside the while loop.
Output a statement showing the number of months it will take for you to pay off your debt.
I'm sure someone in this community can help me. I know this is really basic and pretty rude of me just to ask you guys to help me solve this, but I'm really struggling! (I also know I've made a TON of mistake as it's told me when I've tried to run the program....)
I appreciate any and all help! Thank you!