Access over 20 million homework & study documents

C++ Visual Studio Project DairyAnimal

Content type
User Generated
Subject
Computer Science
Type
Lab
Rating
Showing Page:
1/6
CPPDairyAnimal.cpp
// CPPDairyAnimal.cpp : Denes the entry point for the console application.
//
#include "stdafx.h"
#include "DairyAnimal.h"
#include "Cow.h"
#include "Goat.h"
#include <iostream>
using namespace std;
//Display the amount of milk produced per day using an object created with the default
constructor and 20 pounds of food
void 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 = 2
void 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 milkProducedByCow3()
{
Cow cow(10, 1100);

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/6
cow.feed(25);
cout << "The milk produced by 10 year old, 1100 pound cow, fed 25 pounds: " <<
cow.milk()<< endl;
}
//10.1 year old cow (any weight and amount of food).
void milkProducedByCow4()
{
Cow cow(10.1, 1100);
cow.feed(25);
cout << "The milk produced by 10.1 year old cow (any weight and amount of food): " <<
cow.milk()<< endl;
}
//0.9 year old goat (any weight and amount of food.
void milkProducedByGoat1()
{
Goat goat(0.9f, 10);
goat.feed(10);
cout << "The milk produced by 0.9 year old goat (any weight and amount of food): " <<
goat.milk()<< endl;
}
//1 year old, 90 pound goat which is fed 1 pounds of food.
void milkProducedByGoat2()
{
Goat goat(1, 90);
goat.feed(1);
cout << "The milk produced by 1 year old, 90 pound goat which is fed 1 pounds of food.:
" << goat.milk()<< endl;
}
//A 10 year old, 110 pound goat, fed 2 pounds.
void milkProducedByGoat3()
{
Goat goat(10, 110);
goat.feed(2);
cout << "The milk produced by 10 year old, 110 pound goat, fed 2 pounds: " <<
goat.milk()<< endl;
}
//10.1 year old goat (any weight and amount of food).
void milkProducedByGoat4()
{
Goat goat(10.1, 1100);
goat.feed(25);
cout << "The milk produced by 10.1 year old goat (any weight and amount of food): " <<
goat.milk()<< endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
amountOfMilkProducedPerDay();
displayMilkProduced();
//cow test cases
milkProducedByCow1();
milkProducedByCow2();
milkProducedByCow3();

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/6

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
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 food void amountOfMilkProducedPerDay(){ DairyAnimal dairyAnimal; dairyAnimal.feed(20); cout ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Great! Studypool always delivers quality work.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4