I REALLY NEED HELP WITH THIS

The purpose of this assignment is to write a program that requests the user to
enter the data per year, and that computes the EWMA of the growth rates. It
then should use the EWMA to predict the GNI for the next three years.
The actual growth rate can only be computed from the second year on. The
growth rate for the second year will also be the estimated growth rate for the
third year. Only from the third year on can Equation (2) be used to compute
estimates for the next year.
Let gni prev be the GNI of the previous year, rate prev the actual rate
of the previous year, and rate est the current estimate of the growth rate. If
the user enters a GNI gni current for the current year, then you can compute
the rate for the current year, rate current, and the new estimate, rate est,
as follows:
rate_current = (gni_current-gni_prev)/gni_prev ;
rate_est = LAMBDA * rate_current + (1 - LAMBDA) * rate_est;
Once the rate and estimate have been computed, proceed with the next year,
and store the current GNI as the GNI of the (now) previous year.

THE EXPECTED SCREENSHOT LOOKS SOMETHING LIKE THIS

******Exponential growth predictor*********
In what year does your data start: 2002
Enter data for year 2002 (0 to quit): 76939799
Enter data for year 2003 (0 to quit): 90485490
Enter data for year 2004 (0 to quit): 106534357
Enter data for year 2005 (0 to quit): 119152354
Enter data for year 2006 (0 to quit): 142761445
Enter data for year 2007 (0 to quit): 150300571
Enter data for year 2008 (0 to quit): 0

Estimated growth per year: 14.77%
Prediction for year 2008: 172499885.86
Prediction for year 2009: 197978027.79
Prediction for year 2010: 227219277.80

true!!..sorry..

#include <iostream>
#include <stdlib.h>

using namespace std;

int main ()
{
    //varible declaration
    int year;
    double gni_current;
    double rate_current;
    double rate_est = 0.0;
    double gni_prev;
    double end_year;




    //constant declarations
    const double LAMBDA = 0.2;
    const int START_YEAR = 2000;



    //welcome message

    cout << "\t** ============================ **" << endl;
    cout << "\t** EXPONENTIAL GROWTH PREDICTOR **" << endl;
    cout << "\t** ============================ **\n" << endl;



    cout << "\tIn what year does your data start? : ";
    cin >> year; 

       rate_current = (gni_current-gni_prev)/gni_prev ;
       rate_est = LAMBDA * rate_current + (1 - LAMBDA) * rate_est;


    if (year <= START_YEAR)
    {      cout << "\tPlease enter for the year 2000 and onwards" << endl;
           cout << "\tIn what year does your data start? : ";
           cin >> year;
    }


    cout << "\tEnter data for the year " << year << " (press 0 to quit) : ";
    cin >> gni_current;

    while (year >= START_YEAR)
     {
     cout << "\tEnter data for the year " << year << " (press 0 to quit) : ";
     cin >> gni_current;
     }

    system ("pause");
    return 0;
}

its kinda messed up mann..does anyone see where i went wrong??

I recommend avoid using system("pause").
Instead use cin.getchar()

Also its sarter to ditch using name space std;
Becouse using scopes like this std::cout will prevent conflicts between variable names and the function from std.

Edited 2 Years Ago by Jeroen Mathon

tis is my program..this is the first part the employee.h file

include <string> // program uses C++ standard string class

using namespace std;

// Employee class definition
class Employee

public:
Employee(string name, int monthlysalary);/* Declare a constructor that has one parameter for each data member /
void setfirstname();/
Declare a set method for the employee's first name /
string getfirstname;/
Declare a get method for the employee's first name /
void setlastname();/
Declare a set method for the employee's last name /
string getlastname;/
Declare a get method for the employee's last name /
void setmonthlysalary();/
Declare a set method for the employee's monthly salary /
string getmonthlysalary;/
Declare a get method for the employee's monthly salary /
private:
string firstname();/
Declare a string data member for the employee's first name /
string lastname();/
Declare a string data member for the employee's last name /
int monthlysalary();/
Declare an int data member for the employee's monthly salary */

 // end class Employee

include <iostream>

using namespace std;

include "Employee.h" // Employee class definition

Employee::Employee(string name, int monthlysalary);

{

name = name;
monthlysalary (0);

}

/* Define the constructor. Assign each parameter value to the appropriate data

member. Write code that validates the value of salary to ensure that it is
   not negative. */

void Employee::setfirstname(string name);/* Define a set function for the first name data member. */
{
 setfirstname name;
}

void Employee::getfirstname(string name); /* Define a get function for the first name data member. */
{
 getfirstname name;
}

void Employee::setlastname(string name);/* Define a set function for the last name data member. */
{
 setlastname name;
}

void Employee::getlastname(string name);/* Define a get function for the last name data member. */
{
 getlastname name;
}

void employee::setmonthlysalary(int monthlysalary);
{
 monthlysalary = salary;

/* Define a set function for the monthly salary data member. Write code
that validates the salary to ensure that it is not negative. */

/* Define a get function for the monthly salary data member. */

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