(Before I ask my question, I have tried looking through google and the site already, and didn't find anything relevant to what my problem was. All I was finding was more complex than my current level.)
Anyway, my problem is that I'm getting an "expression must have (pointer-to-) function type error" in my code. I'm confused because I have never seen this type of error before.
Here's what I have so far. (I have pointed out where I have the error in the code.)
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
const int MONTHS_PER_YEAR = 12; // Hard coding Number of Months in a Year
void PrintGreeting(); // Function Prototype for PrintGreeting()
int main ()
{
float purchasePrice; // Declaring Purchase Price
float amountDown; // Declaring Amount Down
float annualInterestRate; // Declaring Annual Interest Rate
int years; // Declaring Number of Years
ifstream din; // Declaring Input File Variable
ofstream dout; // Declaring Output File Variable
float monthlyInterest; // Declaring Monthly Interest
float monthlyPayment; // Declaring Monthly Payment
PrintGreeting(); // Calls PrintGreeting
din.open("vette.in"); // finding vette.in
dout.open("vette.out"); // creating vette.out
din >> purchasePrice >> amountDown >> annualInterestRate >> years; // inputting the values from an input file
monthlyInterest = annualInterestRate / MONTHS_PER_YEAR; // finding the Monthly Interest
monthlyPayment = monthlyInterest(purchasePrice - amountDown); // attempting to find the first part of the equation to find the Monthly Payment. This is the part of the code where I'm getting the error.
return 0;
}
// =======================================================================
void PrintGreeting ()
{
/*
Purpose: Prints a nicely formatted greeting to the screen.
Pre: None.
Post: Greeting has been printed to the screen.
*/
cout << "\n\n\n\n\n";
cout << "Welcome to the EZ Speeeder \n";
cout << "This program is a Monthly Payment Calculator. \n";
cout << "Fall 2012 - Programmed by Zachary Daniels. \n";
cout << "\n\n\n\n\n";
}
The values from the input file are as follows:
The Purchase Price is 105670.00
The Amount Down is 12345
The Annual Interest Rate is 5.7
And the Number of Years is 4.
Can anybody help me figure out why it's giving me this error?