Hey everyone,

I typically don't like to go on forums and throw my code at people and expect answers... but, I'm a beginner (and a little desperate) with all this so a little help would be much appreciated. Here's the details:

- The purpose of the program is to have the user enter their loan amount, number of years of the mortgage, and the annual interest rate of the loan. The program then calculates the fixed monthly payment, total payment, interest paid, and principal paid.
- The formula to calculate the interest paid in the current month:

interestPaid = (annualInterestRate / 1200) * outstandingLoanAmount.

- The formula to calculate principalPaid during the current month:

principalPaid = monthlyPayment – interestPaid in the current month.

- The formula to calculate subsequent outstandingLoanAmount:

outstandingLoanAmount = outstandingLoanAmount – principalPaid in the current month.For the first month, the outstandingLoanAmount is the same as the loanAmount.

- The formula to calculate the interest paid in the current month:
- I'm trying to write a program that displays the following:

Fixed monthly payment: $xxx.xx

Total payment: $xxxxx.xxMonth Interest Paid Principal Paid.

------- --------------- ----------------

1 $aaa.aa $bbb.bb

2 $ccc.cc $ddd.dd

3 $eee.ee $fff.ff

• • •

• • •

• • •

----------- -----------------

Total $yyyy.yy $zzzzz.zz - My program consists of two .cpp files and one header file.

I'd hate to post the entirety of my code, so I'm only going to paste what I think is necessary to answer my question.

**Main Function:**

```
int main()
{
double loanAmount;
int numOfYears;
double annualInterestRate;
int displayResult;
Mortgage myMortgage();
cout << "Enter loan amount: \n";
myMortgage.setLoanAmount( loanAmount );
cout << "Enter number of years: \n";
cin >> numOfYears;
cout << "Enter annual interest rate: \n";
cin >> annualInterestRate;
cout << displayResult;
return 0;
}
```

**Mortgage Constructor:**

```
Mortgage::Mortgage (double amount, int years, double annualRate)
{
//loanAmount = amount;
setLoanAmount(amount);
//numOfYears = years;
setNumOfYears(years);
//annualInterestRate = annualRate;
setAnnualInterestRate(annualRate);
}
```

**Set Function:**

```
void Mortgage::setLoanAmount ( double amount )
{
loanAmount = amount;
}
```

When I attempt to start without debugging, I receive the following error:*error C2228: left of '.setLoanAmount' must have class/struct/union*

I appreciate any help I can get. If the code I provided isn't enough code for you to help, I will be more than glad to post more. Thanks a lot.