Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- // globals!
- const int dailyEstimate = 15; // In litres and when well fed.
- // base class!
- class Animal {
- public: int age;
- public: string name;
- public: string breed;
- };
- class DairyCow : public Animal {
- protected: int milkProduction;
- public: int feedingCost;
- // estimates milk production based on the cow’s breed and feeding cost
- public: int calculateMilkYield( DairyCow cow ) {
- cout << "Ze cow of name: !!" << cow.name << endl;
- cout << "Estimate output from age, breed and feeding cost" << endl;
- }
- };
- int main() {
- DairyCow cow;
- // assign values to props: name, breed, age, feedingCost:
- // @TODO the milkProduction is derived from the above values.
- cout << "Please enter the FOUR cow details ( props ) below ::: " << endl;
- cout << "Enter Cow name : " << endl;
- cin >> cow.name;
- cout << "Entry assignment : Cow name === " << cow.name << endl;
- cout << "Enter Cow breed eg Friesian, Jersey, Sahiwal etc : " << endl;
- cin >> cow.breed;
- cout << "Entry assignment : Cow breed === " << cow.breed << endl;
- cout << "Enter Cow age eg 7 (for 7 yrs ): " << endl;
- cin >> cow.age;
- cout << "Entry assignment : Cow age === " << cow.age << " years" << endl;
- cout << "Enter Cow feedingCost ( Kshs): " << endl;
- cin >> cow.feedingCost;
- cout << "Entry assignment : Cow feedingCost === " << cow.feedingCost << " Kshs" << endl;
- cout << "Exec calculateMilkYield ..... " << endl;
- cow.calculateMilkYield( cow );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement