Create a Duck class. The attributes of Duck are: number and energy Implement the following methods: Duck(int); //Constructor to assign a number to duck and set its energy to 10 void eat(); //when duck eats, energy increases by 3 void swim(); //when duck swims, energy decreases by 2 void walk(); //when duck walks, energy decreases by 1 void print(); //prints energy of duck   Then  Create a Monkey class. The attributes of Monkey are: number and energy Implement the following methods: Monkey(int); //Constructor to assign a number to monkey and set its energy to 10 void eat(); //when monkey eats, energy increases by 10 void jump(); //when monkey jumps, energy decreases by 4 void walk(); //when monkey walks, energy decreases by 2 void print(); //prints energy of monkey You need to make a Zoo with following requirements: Duck lives in a Zoo Monkey lives in a Zoo Zoo has 10 ducks (Hint: You will need an array of pointers to Duck class) Zoo has 5 monkeys (Hint: You will need an array of pointers to Monkey class) Zoo can make all ducks eat Zoo can make all monkeys eat Zoo can make all ducks swim Zoo can make all ducks walk Zoo can print energies of all ducks Zoo can print energies of all monkeys Overload all the functions of Zoo class with 'number of ducks'/'number of monkeys' as parameter. Classes should be defined in Functions.h Additional function(s) should be written in Functions.cpp and used in main.cpp

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Create a Duck class.

The attributes of Duck are: number and energy Implement the following methods: Duck(int); //Constructor to assign a number to duck and set its energy to 10 void eat(); //when duck eats, energy increases by 3 void swim(); //when duck swims, energy decreases by 2 void walk(); //when duck walks, energy decreases by 1 void print(); //prints energy of duck

 

Then 

Create a Monkey class.

The attributes of Monkey are: number and energy Implement the following methods: Monkey(int); //Constructor to assign a number to monkey and set its energy to 10 void eat(); //when monkey eats, energy increases by 10 void jump(); //when monkey jumps, energy decreases by 4 void walk(); //when monkey walks, energy decreases by 2 void print(); //prints energy of monkey

You need to make a Zoo with following requirements:

Duck lives in a Zoo Monkey lives in a Zoo Zoo has 10 ducks (Hint: You will need an array of pointers to Duck class) Zoo has 5 monkeys (Hint: You will need an array of pointers to Monkey class) Zoo can make all ducks eat Zoo can make all monkeys eat Zoo can make all ducks swim Zoo can make all ducks walk Zoo can print energies of all ducks Zoo can print energies of all monkeys

Overload all the functions of Zoo class with 'number of ducks'/'number of monkeys' as parameter.

Classes should be defined in Functions.h

Additional function(s) should be written in Functions.cpp and used in main.cpp

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY

Expert Answers to Latest Homework Questions

Q: Country ISOCode3 Name PopDensity NIC MLT Nicaragua Malta 140 3920 LBN Lebanon 1730 Complete the…
Q: CREATE TABLE Country ( ); Name VARCHAR(60), ISOCode2 CHAR (2), IndepYear SMALLINT, Population…
Q: Jump to level 1 CREATE TABLE Country ( Name VARCHAR (60), Population INTEGER, Over 65 PopPct FLOAT,…
Q: Refer to the CREATE TABLE statement: CREATE TABLE Country ( ); Name VARCHAR (50), Population INT,…
Q: Mysteries of Mental Illness: Evil or Illness: Please describe the mental health issues affecting to…
Q: Mysteries of Mental Illness: Evil or Illness: Please describe the mental health issues affecting to…
Q: Capacitance  Problem 18:  A cylindrical capacitor is made of two concentric conducting cylinders.…
Q: Textbook: The Criminalization of Mental Illness: Crisis and Opportunity for the Justice System 2nd…
Q: Textbook: The Criminalization of Mental Illness: Crisis and Opportunity for the Justice System 2nd…
Q: Articles: Lijun, S. (2015, July). Does who you know in the positional hierarchy protect or hurt?…
Q: What is stigma? What are the components of stigma? (pp. 56-59) Textbook: Criminalization of Mental…
Q: Select the ADKAR diagnostic model. You are looking at the Drury hotel parts and strategies for this…
Q: 4)    A half adder is a circuit that adds two bits to produce two outputs: The result of the sum,…
Q: The electric field has a constant value of 2.5 x 10V/m and is directed downward. The field is the…
Q: 4. Match each equation in rectangular coordinates with its equation in polar coordinates. (a) x² +…
Q: 3. Find the equation of the tangent line to the curve x = sin 2t + cost, y = cos 2t-sint when t=π.
Q: 2. Define functions sinh(x) and cosh(x) as follows: sinh(r) = = e-e 2 e² + ex and cosh(): = 2 These…
Q: Current and Resistance  Problem 14:  Resistivity in metals increases with temperature according to…
Q: Automated Computation questions: What shortcomings of electrical computation will optical computing…
Q: The potential difference between the plates of acapacitor is 233 V. Midway between the plates,…
Q: 1. (a) Use that e = n=0 for all to find the Maclaurin series for e-T². 1 (b) Use part (a) to write Г…