C++ Visual Studio Project DairyAnimal

Feb 3rd, 2012
Studypool Tutor
Price: $20 USD

Tutor description

Write a base class named DairyAnimal and two classes, Goat and Cow that inherit from it. You may use one file, or a multi-file project; whichever is easier for you. 1. Declare a DairyAnimal class 2. Use inheritance to declare a Cow class 3. Use inheritance to declare a Goat class.

Word Count: 669
Showing Page: 1/6
CPPDairyAnimal.cpp// CPPDairyAnimal.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "DairyAnimal.h"#include "Cow.h"#include "Goat.h"#include using namespace std;//Display the amount of milk produced per day using an object created with the default constructor and 20 pounds of foodvoid amountOfMilkProducedPerDay(){DairyAnimal dairyAnimal;dairyAnimal.feed(20);cout << "The amount of milk produced per day using an object created with the default constructor and 20 pounds of food: " << dairyAnimal.milk()<< endl;}//Display the milk produced using an object created with the overloaded constructor and with age = 1, weight = 100 and lbsFood = 2void displayMilkProduced(){DairyAnimal dairyAnimal(1, 100);dairyAnimal.feed(2);cout << "The milk produced using an object created with the overloaded constructor and with age = 1, weight = 100 and lbsFood = 2: " << dairyAnimal.milk()<< endl;}//0.9 year old cow (any weight and amount of food. void milkProducedByCow1(){Cow cow(0.9f, 10);cow.feed(10);cout << "The milk produced by 0.9 year old cow (any weight and amount of food): " << cow.milk()<< endl;}//1 year old, 900 pound cow which is fed 15 pounds of food. void milkProducedByCow2(){Cow cow(1, 900);cow.feed(15);cout << "The milk produced by 1 year old, 900 pound cow which is fed 15 pounds of food.: " << cow.milk()<< endl;}//A 10 year old, 1100 pound cow, fed 25 pounds. void milkProd

Review from student

Studypool Student
" Excellent job "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors