All pastes #464729 Raw Edit

losl

public cpp v1 · immutable
#464729 ·published 2007-04-29 17:54 UTC
rendered paste body
// Stephen Jackson// Section Wilkerson// 4 / 4 / 07// Something about cows#ifndef BOVINE_H#define BOVINE_H#include <cstdlib>#include <iostream>#include <string>#include <cmath>#include <fstream>#include "disease.h"using namespace std;// IMPORTANT CONSTANTS// The following must be declared globablly in some fileconst float BOVINE_PERCENT_RETAINED = 0.1; //How much food is retained by the animalconst float BOVINE_PERCENT_POOED = 0.3;const float BOVINE_FERTILITY_RATE = 0.5;const char BOVINE_DEFAULT_CLASS = '\0'; //Default Classificationconst char BOVINE_HEIFER_CLASS = 'h';const char BOVINE_COW_CLASS = 'c';const char BOVINE_STEER_CLASS = 's';const char BOVINE_BULL_CLASS = 'b';const int BOVINE_MAX_WEIGHT = 80;  //Default Weightconst int BOVINE_MIN_WEIGHT = 70;  //Default Weightconst int BOVINE_MAX_CWUF = 10;const int BOVINE_MIN_CWUF = -5;const float BOVINE_FACTOR_CWUF = 100.0;const int BOVINE_ADULTHOOD_DAY = 729;const int BOVINE_PERCENT_PRECISION = 10000;const string NAMES_FILE = "names.dat";const int NAMES_COUNT = 24;const int BOVINE_PREG_TERM = 282;class disease;class bovine{  //Special Addition to bClass. There is a legal flag of Null byte to represent a null cow for the purpose  //Of function arguement default cases!    friend void exposeToDisease(const disease &aDisease, bovine &aCow);  friend class farmer;    public:    //Bovine Function without arguements for making a herd    //Precondition: None    //Postcondition: A Well Configured Bovine    bovine();        //Overloaded Bovine    //Precondition: Character for determining gender status of cow (They are very sensitive about this sort of thing) and its weight.    //PostCondition: A well Configured Bovine    bovine(char classification, int weight, int age, string name);        //Print Command    //Precondition: None    //Postcondition: Out put to the screen displaying wonderful factiods about the bovine (NO TRAILING ENDL)    void print() const;        //Eat Command    //Precondition: Two Integers, The first of which must be smaller than the second of which and must have a range of at least 1~!    //Postcondition: A fatter Bovine.    void eat(int minFoodConsumed, int maxFoodConsumed);        //Print Total Consumed    //Precondition: None    //Postcondition: A total of the amount of food the bovine has consumed so far returned from the func    float getTotalFeedConsumed() const;        //Get Bovine Flag    //Precondition: None    //Postcondition: A Char with the flag of the bovine    char getBovineFlag() const;        //BoomShakaLaka (AKA INTERCOURSE :O :O :O)    //Precondition: Assumed To be Checked. Cow must be h or c class.    //PostCondition: Perhaps a cow who is pregnant? ? ?    bool boomShakaLaka();        //kill()    //Preconditon: None    //Postconditon: bDead set to true;    void kill();        //isDead;    //precondtion: None    //postconditon: boolean statement about the aliveness of the cow    bool isDead() const;        //getAge    //precondtion: None    //Postcondtion: the age of the cow returned as int    int getAge() const;        //Age Command    //Precondition: None    //Postcondition: The bovine's age increased by one, a bovine produced if they are due.    bovine age();        //fetches the cow's Name    //Precondition: None    //Postcondition: The cows name returned as string    string getName() const;      private:    int bTotalFoodConsumed; //How Much Food they Ate;    int bAge;               // Age In Days    float bWeight;          // the weight of the bovine in question    float bTotalWaste;      // The amount of poo the cow has made    char bClass;            // The gender related issues of the cow    bool bDead;             // Boolean Dead    bool bPreg;             // If the cow is pregnant    int bPregStart;         // day thier pregnancy started.    disease bDisease;       // The disease the cow is infected with    string bName;           // Cow's Name        //Poo Command    //Precondition: Some amount of consumed Food    //Post Condtion: A fine pile of excrement    float poo(int foodConsumed);};//+ operator override//Pre: Takes in two cows and if they are politically correct they DO IT. ooo//Post: a knocked up cowbool operator+(bovine &cattleA, bovine &cattleB);// ! operator override//Pre: Takes in a cow, that may or may not already be dead//Post: Kills the cow if it isn't already dead and returns true if the cow was sucessfully executed haha pun.bool operator!(bovine &cattleA);#endif