title: Car Class C++ Second set of eyes
body: <p>I just finished this as a project, the code runs fine, any folks have any tips. It's always nice to have a second set of eyes take a look. 
  Instructions:
  Car Class:
  Write a class named Car that has the following:
  year. An int that holds the cars model year.
  make. A string object that holds the make of car.
  speed. An int that holds the cars current speed.</p>
  
  <p>In addition, the class should have the following member functions.</p>
  
  <p>Constructor. The constructor should accept the car's year and make as arguments and assign these values to a object's year and make member variables. The constructor should initialize the speed member variable to 0.</p>
  
  <p>Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's year, make, and speed member variables.</p>
  
  <p>accelerate. the accelerate function should add 5 to the speed member variable each time it is called.</p>
  
  <p>brake. The brake function should subtract 5 from the speed member variable each time it is called.</p>
  
  <p>Demonstrate the class in a program that creates a Car object, and then calls accelerate function five times. After each call to the accelerate function, get the current speed of the car and display it. The, call the brake function five times. After each call to the brake function, get the current speed of the car and display it.</p>
  
  <pre><code>**Car.h**
  
  #ifndef CARH
  #define CARH
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  class Car
  {
  public:
      Car(int year, string makee);
  
      void brake();
  
      void accelerate();
  
      void setSpeed(int sp);
  
      int getSpeed();
  
      void setMake(string makee);
  
      string getMake();
  
  
      void setyearModel(int year);
  
      int getyearModel();
  
  
  private:
      int yearModel;
      string make;
      int speed;
  };
  #endif
  
  **Car.cpp**
  
  // Class Default Constructor
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "Car.h"
  
  using namespace std;
  Car::Car(int year, string makee)
  {
      yearModel = year;
      make = makee;
      speed = 0;
  }
  
  void Car::brake()
  {
      speed = speed - 5;
  }
  
  void Car::accelerate()
  {
      speed = speed + 5;
  }
  
  
  void Car::setSpeed(int sp)
  {
      speed = sp;
  }
  
  int Car::getSpeed()
  {
      return speed;
  }
  
  void Car::setMake(string makee)
  {
      make = makee;
  }
  
  string Car::getMake()
  {
      return make;
  }
  
  
  void Car::setyearModel(int year)
  {
      yearModel = year;
  }
  
  int Car::getyearModel()
  {
      return yearModel;
  }
  
  
      **Jetta_TDI.cpp**
  
      #include "stdafx.h"  
      #include &lt;iostream&gt;  
      #include "Car.h"
  
      // Namespaces utilized in this program
      using namespace std;
  
  
          int main(int argc, char *argv[])
          {
              Car Volkswagen(2013, "Jetta TDI");
              cout &lt;&lt; "Accelerate" &lt;&lt; endl;
              for (int i = 0; i &lt; 5; i++)
              {
                  Volkswagen.accelerate();
                  cout &lt;&lt; "Current Speed: " &lt;&lt; Volkswagen.getSpeed() &lt;&lt; endl;
              }
              cout &lt;&lt; endl;
              cout &lt;&lt; "Decelerate" &lt;&lt; endl;
              for (int i = 0; i &lt; 5; i++)
              {
                  Volkswagen.brake();
                  cout &lt;&lt; "Current Speed: " &lt;&lt; Volkswagen.getSpeed() &lt;&lt; endl;
              }
              cout &lt;&lt; endl;
              system("pause");
              return 0;
          }
  </code></pre>