This first function works, but I have to give the user a monthly payment of either "The minimum payment is the total amount due if that is 10 or less; otherwise, it is 10 or 10% of the total amount owed, whichever is larger." My rate_maker function doesn't pass the value of total_value to min_payment function's variable total_value (everything's 0's)?? Once again, I'm at an impasse!
Thank you for any help:

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

double rate1, rate2, payment, balance, balance1, balance2, total_due;

double rate_maker(double rate1, double rate2, double balance, double balance1, double balance2, double total_due);
double min_payment(double total_due,double payment);

double rate_maker(double rate1, double rate2,double balance, double balance1,double balance2, double total_due)
{

if(balance <= 1000)
{
balance1 = balance * .015;
total_due = balance1;
}

else if(balance > 1000)
{
balance1 = (1000 * .015);
balance2 = (balance - 1000 * .01);
total_due = balance1 + balance2;

;
}

}

double min_payment(double total_due, double payment)

{
if(total_due <= 10)
{
payment = total_due;
return payment;
}
else if(10 < total_due * .01)
{
payment = total_due * .01;
return payment;

}
else
{
payment = 10;
return payment;
}
}

int main()
{
double interest, monthly;

cin >> balance;
interest = rate_maker(rate1,rate2,balance,balance1,balance2,total_due);
cout << "Your total due is: " << interest << endl;
cin >> total_due;
monthly = min_payment(total_due,payment);
cout <<"Your monthly payment is: " << monthly << endl;

int x;
cin >> x;

return 0;
}``````

## All 4 Replies

This won't solve your problem but min_payment() needs to be restructured so that there is only one return statement. No need for all those returns -- just put one at the end of the function. Same for min_payment()

Actually, making the above changes did fix the problem. Here is the output

100
1