Reference no: EM13810344
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 a. Write a base class named DairyAnimal that has the following data members:
float age; // years int weight; // weight of animal in pounds int food; // food eaten each day in pounds
b. And the following functions:
DairyAnimal(); // set age to 1.0F, weight to 1000, and food to 0 DiaryAnimal(float a, int w); // overloaded constructor lets you set age and weight void feed(int f); // pounds of food fed to the animal per day float milk(); // gallons of milk produced per day = weight / food
c. Write two tests: 1) Display the amount of milk produced per day using an object created with the default constructor and 20 pounds of food. 2) Display the milk produced using an object created with the overloaded constructor and with age = 1, weight = 100 and lbsFood = 2.
2. Use inheritance to declare a Cow class
a. Override the milk function to use the following calculations:?If the age is 1 or more and 10 or less, gallons of milk = 0.5 * weight / food?Otherwise, gallons of milk = 0
d. Write tests for a: 1) 0.9 year old cow (any weight and amount of food. 2) 1 year old, 900 pound cow which is fed 15 pounds of food. 3) A 10 year old, 1100 pound cow, fed 25 pounds. 4) 10.1 year old cow (any weight and amount of food).
3. Use inheritance to declare a Goat class.
a. This class will use DairyAnimal as a base class and inherit the public functions. Decide whether or not you will need to write new constructors.
b. Override the milk function to use the following calculations:?If the age is 0.7 or more and 10 or less, gallons of milk = weight / food?Otherwise, gallons of milk = 0.
Can you call the base class milk function?
c. Write the same four tests as for the Cow class, but use the following weights and amounts of food:
2) weight = 90 pounds, food = 1 pound
3) weight = 110 pounds, food = 2 pounds.
Situation facing mensa at the time of the case
: Describe the situation facing Mensa at the time of the case. This should include the major issues facing the company and the decisions that need to be made.
|
Statement regarding executive stock-lower risk free rates
: Lower risk free rates results in __________ Put Option prices and ______ Call Option Prices. Which statement regarding executive stock options is correct?
|
Best strategic planning and implementation
: Explain the BEST strategic planning and implementation/execution you have observed. Discuss fully. (2) Explain the WORST strategic planning and implementation/execution you have observed. What would you have done differently? Be specific. NOTE: Do..
|
Scope of project on upgrading office center
: Define the scope of the project on upgrading a office center in which you have 7 months to complete include the project goals and objectives, deliverables, tasks, costs, deadlines, and expected main staffing and non-staffing resources needed.
|
Write a base class named dairyanimal
: 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
|
Achieving innovation in project-based firms
: Which of the approaches for achieving innovation in project-based firms is the most viable across the greatest variety of scenarios? Why? The approaches are the Linear-rational approach, and the Organic approach.
|
Setting the price on a new outpatient service
: Assume that managers of Fort Winston Hospital are setting the price on a new outpatient service. Here are the relevant data estimates: Variable cost per visit $5.00 Annual direct fixed costs $500,000 Annual overhead allocation $50,000 Expected annual..
|
Create two function for converting between units of distance
: It's often necessary to convert between units. In this exercise, you will create two functions for converting between units of distance. The first function will be called ConvertMilesToKilometers(), which will accept one parameter for the number o..
|
Safety and occupational health professional
: You are the safety and occupational health professional for your city's Health Department. You received a call from a major food distribution warehouse that some employees are complaining of dizziness and feeling sick.
|