topical media & game development

talk show tell print

professional-program-10-WeatherPrediction-WeatherPrediction.c

? / professional-program-10-WeatherPrediction-WeatherPrediction.c


  include <iostream>
  
  include <WeatherPrediction.h>
  
  using namespace std;
  
  void WeatherPrediction::setCurrentTempFahrenheit(int inTemp)
  {
    mCurrentTempFahrenheit = inTemp;
  }
  
  void WeatherPrediction::setPositionOfJupiter(int inDistanceFromMars)
  {
    mDistanceFromMars = inDistanceFromMars;
  }
  
  int WeatherPrediction::getTomorrowTempFahrenheit()
  {
    // Obviously, this is nonsense
    return (mDistanceFromMars / 1000) + mCurrentTempFahrenheit;
  }
  
  double WeatherPrediction::getChanceOfRain()
  {
    // Obviously, this is nonsense too
    return 0.5;
  }
  
  void WeatherPrediction::showResult()
  {
    cout << "Result: " << (getChanceOfRain() * 100) << " chance."
         << " Temp. " << getTomorrowTempFahrenheit() << endl;
  }
  
  /*
  int main()
  {
    WeatherPrediction p;
    p.setCurrentTempFahrenheit(24);
    p.setPositionOfJupiter(80);
    p.showResult();
  }
  */
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.