#include <cmath>
#include <iostream>

using namespace std;

//Function prototypes
    void getPrice (float&);
    void getInterestRate (float&, float&, float&);
    void getDownPayment ( float&);
    void gettradeIn (float&);
    void calcmonPayment (float, float, float, float, float, float&);

int main()
{
    
    
    
    // Input variables
    float price;
    float downPayment;
    float tradeIn;
    float loanAmt;
    float annualIntRate;
    float annualIntPercent;
    float monIntRate;
    float noMos;
    float monPayment;
    int count;
    // get price
    getPrice(price);

    // get interest rate
    getInterestRate (annualIntRate, annualIntPercent, monIntRate);

    while (count < price)
    {
        getDownPayment(downPayment);
        gettradeIn (tradeIn);
        calcmonPayment (price, downPayment, tradeIn, noMos, loanAmt, monPayment );
        cout << "\n\nprice of vehcile is" << monPayment << "per month\n\n";
            monPayment = annualIntRate  / 12.0;

       count++;
    }
    cin.get(); // Wait for keypress before exiting.
    cin.get(); // Wait for keypress before exiting.
    return 0;    
}

// get price of vehicle
void getPrice (int & price)
{
    while ( price < 50000.00|| price > 0)

    {
        cout << "Enter the price of the Vehicle: ";
        cin >> price;
        if (price > 50000.00)
            cout << "Enter a price less than 50.\n";
        if (price < 50.00)
            cout << "Enter a price less that 50000.\n";
    }
    return;
}
// get tile size in inches
     void getInterestRate( float& annualIntRate, float& annualIntPercent,
                            float& monIntRate);

    {

     
     while (annualIntRate >= 0 || annualIntRate > .50)
    {
        cout << "Enter the annual interest rate in decimals ";
        cin >> annualIntRate;
        if (.50 < annualIntRate < 0)
            cout << "Enter a number less than .50 and greater than 0.\n";
    }
     return;
    }
}
// getdownPayment:  Prompts the user for the downPayment 
void getdownPayment(float& downPayment);
{
    

    bool dataInvalid = true; // Start with invalid data to begin the while loop
    
    // Get our downPayment
    //
    while(dataInvalid) 
    {
        cout << "enter the down payment ";
        cin >> downPayment 
        if (downPayment < 0)
        {
            cout << "------ Positive Values Only, reenter data. --------\n";
            dataInvalid = true;
       
        
        {
            dataInvalid = false;
        }
    }
        dataInvalid = true; // Start off invalid so the loop will execute
     // Get our down payment check for errors
    
    while(dataInvalid)
    }

     return;

}
// get trade in value
     void gettradeIn( float& tradeIn);
{
     while (tradeIn >= 0)
     {
        cout << "Enter the value of the trade in ";
        cin >> tradeIn;
        if ( annualIntRate < 0)
            cout << "Enter a number greater than 0.\n";
    }
     return;
}
// calculate the monthly payment for vehicle
void calcmonPayment(float price, float downPayment, float tradeIn, 
                    float noMos, float monPayment, float loanAmt);


    {

    
    // Convert feet to inches
    monIntRate =  (annualIntRate)  / 12.0;
   annualIntPercent = (annualIntRate) * 100.0;

   loanAmt = ((price) – (downPayment) – (tradeIn)); 

   monPayment = (loanAmt * monIntRate)/(1 –(1 + monIntRate) -pow(noMos);  
   noMos = 24, 36, 48, 60; 


    
    return; 
    
}

that is the code I have been working on.

here are the errors
1. warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
2. error C2447: '{' : missing function header (old-style formal list?)
3.: error C2059: syntax error : '}'
4 : error C2143: syntax error : missing ';' before '}'
5 : error C2059: syntax error : '}'
6: error C2447: '{' : missing function header (old-style formal list?)
7: error C2447: '{' : missing function header (old-style formal list?)
8 error C2447: '{' : missing function header (old-style formal list?)
9: error C3209: ' ' : Unicode identifiers are not yet supported
10: error C3209: ' ' : Unicode identifiers are not yet supported
11: error C3209: '(1' : Unicode identifiers are not yet supported

It is suppose to ask for the price, interest rate, down payment, trade in, and then give them monthly payment for 24 \, 36, 48, 60;mos

I have hit a brick wall any help is appriciated on getting this code worked out. Thanks!!!

Emily

There are too many compile errors to be counted.
For example

void getdownPayment(float& downPayment)[B]; // you dont need this semicolon[/B]
{

There are a lot of functions that have similar errors.

Also it looks as if you are not saving the file in ASCII format. Best thing is to copy and paste the code to notepad and overwrite your original source file using notepad save as. That should rid you of the unwanted unicode characters.
Your compiler outputs the line numbers where the compile errors occur. Go to those lines and correct them yourself.
Properly indent the code. I see some mismatched braces and brackets. you can catch those by properly indenting code.

#include <cmath>
#include <iostream>

using namespace std;

//Function prototypes
    void getPrice (float&);
	void getInterestRate (float&, float&, float&);
	void getDownPayment ( float&);
	void gettradeIn (float&);
	void calcmonPayment (float, float, float, float, float, float&) ;

int main()
{
	
	
	
	// Input variables
	float price;
    float downPayment;
	float tradeIn;
	float loanAmt;
	float annualIntRate;
	float annualIntPercent;
	float monIntRate;
	float noMos;
	float monPayment;
	int count;
	// get price
	getPrice(price);

	// get interest rate
	 getInterestRate (annualIntRate, annualIntPercent, monIntRate);

	while (count < price)
	{
		getDownPayment(downPayment);
		gettradeIn (tradeIn);
		calcmonPayment (price, downPayment, tradeIn, noMos, loanAmt, monPayment );
		cout << "\n\nprice of vehcile is" << monPayment << "per month\n\n";
			monPayment = annualIntRate  / 12.0;

       count++ ;
    }
    cin.get(); // Wait for keypress before exiting.
    cin.get(); // Wait for keypress before exiting.
    return 0;    
}

// get price of vehicle
void getPrice (int& price)
{
    while ( price < 50000.00|| price > 0)

	{
        cout << "Enter the price of the Vehicle: ";
        cin >> price;
        if (price > 50000.00)
            cout << "Enter a price less than 50.\n";
		if (price < 50.00)
			cout << "Enter a price less that 50000.\n";
    }
	return ;
}
// get interest rate
     void getInterestRate( float& annualIntRate, float& annualIntPercent,
	 	                   float& monIntRate)

	{

	 
	 while (annualIntRate >= 0 || annualIntRate > .50)
	{
        cout << "Enter the annual interest rate in decimals ";
        cin >> annualIntRate;
        if (annualIntRate < 0 || annualIntRate > .50)
            cout << "Enter a number less than .50 and greater than 0.\n";
    }
	 return ;
	}

// getdownPayment:  Prompts the user for the downPayment 
void getdownPayment(float& downPayment)
 {
    

    bool dataInvalid = true; // Start with invalid data to begin the while loop
    
    // Get our downPayment
	//
    while(dataInvalid) 
	{
        cout << "enter the down payment ";
        cin >> downPayment; 
        if (downPayment < 0)
		{
            cout << "------ Positive Values Only, reenter data. --------\n";
            dataInvalid = true;
       
		
		}
            dataInvalid = false;
        
    }
		dataInvalid = true; 
		// Start off invalid so the loop will execute
     // Get our down payment check for errors
	
    while(dataInvalid);
	

   

// get trade in value
void gettradeIn( float& tradeIn);
{
	 while (tradeIn >= 0)
	 {
        cout << "Enter the value of the trade in ";
        cin >> tradeIn;
        if ( annualIntRate < 0)
            cout << "Enter a number greater than 0.\n";
	 }
	 return ;
}
// calculate the monthly payment for vehicle
void calcmonPayment(float price, float downPayment, float tradeIn, 
					float noMos, float monPayment, float loanAmt)


	

	
    // fine monthly payment
    monIntRate =  (annualIntRate)  / 12.0 ;
   annualIntPercent = (annualIntRate) * 100.0 ;

   loanAmt = (price – downPayment – tradeIn); 

   monPayment = ((loanAmt * monIntRate))/(1 –(1 + monIntRate)) -pow(noMos)));  
   noMos = 24, 36, 48, 60; 


    
    return ; 
    
}

now here are my errors
: warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
: error C2065: 'tradeIn' : undeclared identifier
: fatal error C1903: unable to recover from previous error(s); stopping compilation

Thanks in advance for any help correcting these

To many errors you have. Remove ; after void gettradeIn( float& tradeIn) . Where void getdownPayment(float& downPayment) func ends?

You should read wolfpack's post more carefully:

For example

Code:
void getdownPayment(float& downPayment); // you dont need this semicolon{

There are a lot of functions that have similar errors.

Still in your code:

void gettradeIn( float& tradeIn); //remove semicolon

Edited 6 Years Ago by Nick Evan: n/a

This article has been dead for over six months. Start a new discussion instead.