The program needs to get loan amount, loan term, and loan interest rate from the user and then use those same numbers to create a function that calculates the monthly payment of the loan using monthlyPayment = principal * rate / ( 1.0 – pow(rate + 1, -term));

I've come this far. After I get the amounts from the user, how do I use what they inputed to save in the program so I can use those same answers in the monthlyPayment function for the calculation? Any help is greatly appreciated!

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
class Payment {
    private:
  int amount;
int term;
double interest;
public:
int getAmount(int amount) {
cout << "Enter your loan amount: " << amount << endl;
if (amount <= 0)
    cout << "please enter a valid entry." << endl;
return amount;
}
int getTerm(int term) {
cout << "Enter your term: " << term;
if (term <= 0)
    cout << "please enter a valid entry." << endl;
return term;
}
double getInterest(int interest) {
cout << "Enter your interest rate: " << interest << endl;
if (interest <= 0)
    cout << "please enter a valid entry." << endl;
return interest;
}
void monthlyPayment();
void displayMessage();
};
int main ()
{
}
void monthlyPayment() {
}

I have the same assignment.. I've come this far. After I get the amounts from the user, how do I use what they inputed to save in the program so I can use those same answers in the monthlyPayment function for the calculation? Any help is greatly appreciated!

#include <iostream>

#include <string>

#include <cmath>

using namespace std;

class Payment {

    private:

  int amount;
int term;
double interest;

public:

int getAmount(int amount) {
    cout << "Enter your loan amount: " << amount << endl;
    if (amount <= 0)
        cout << "please enter a valid entry." << endl;
    return amount;
    }

int getTerm(int term) {
    cout << "Enter your term: " << term;
    if (term <= 0)
        cout << "please enter a valid entry." << endl;
    return term;
}

double getInterest(int interest) {
    cout << "Enter your interest rate: " << interest << endl;
    if (interest <= 0)
        cout << "please enter a valid entry." << endl;
    return interest;
}

void monthlyPayment();
void displayMessage();
};

int main ()

{

}

void monthlyPayment() {

}