C++ programing. In nature, scientists have determined there are two types of bees: friendly bees and mean bees. A friendly bee will only sting a mean person if they refuse to become nice when asked and will never sting people that are not mean. On the other hand, a mean bee stings everyone. Given the following classes, main and sample run, create classes that represent these bees. Use the given Bee class. class Person{ public: bool mean; //true means they are mean, false they are not mean bool stung; //true means they got stung, false means they did not get stung Person(bool mean) { this->mean=mean; stung=false; //all people start out not being stung } }; Main (sample run below): int main(int argc, char** argv){ Person p(true); Person p2(false); Person p3(true); class Bee{ public: virtual bool sting(Person &p)=0; }; Person p4(false); cout<<"p: mean-"<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ programing.

 In nature, scientists have determined there are two types of bees: friendly bees and mean bees. A friendly bee will only sting a mean person if they refuse to become nice when asked and will never sting people that are not mean. On the other hand, a mean bee stings everyone.

Given the following classes, main and sample run, create classes that represent these bees. Use the given Bee class.

class Person{ public:

bool mean; //true means they are mean, false they are not mean
bool stung; //true means they got stung, false means they did not get stung

Person(bool mean)

{
this->mean=mean;
stung=false; //all people start out not being stung

} };

Main (sample run below):

int main(int argc, char** argv){ Person p(true);
Person p2(false);
Person p3(true);

class Bee{

public:
virtual bool sting(Person &p)=0;

};

Person p4(false);

cout<<"p: mean-"<<p.mean<<", stung-"<<p.stung<<endl; cout<<"p2: mean-"<<p2.mean<<", stung-"<<p2.stung<<endl; cout<<"p3: mean-"<<p3.mean<<", stung-"<<p3.stung<<endl; cout<<"p4: mean-"<<p4.mean<<", stung-"<<p4.stung<<endl;

Friendly_bee b1; Mean_bee b2;

b1.sting(p); b1.sting(p2);

b2.sting(p3); b2.sting(p4);

cout<<"p: mean-"<<p.mean<<", stung-"<<p.stung<<endl; cout<<"p2: mean-"<<p2.mean<<", stung-"<<p2.stung<<endl; cout<<"p3: mean-"<<p3.mean<<", stung-"<<p3.stung<<endl; cout<<"p4: mean-"<<p4.mean<<", stung-"<<p4.stung<<endl;

}

Sample Run:

p: mean-1, stung-0 //mean is 1 (true), not mean is 0 (false)...stung is 0 for all (false) p2: mean-0, stung-0
p3: mean-1, stung-0
p4: mean-0, stung-0

-----
Friendly bee says: Hello! :) If you stop being mean, I won't sting you. Will you stop being mean? no
Friendly bee says: Sorry, but then I have no choice but to sting you! :(

-----
Friendly bee says: Hello! :) You're not mean, so I won't sting you!

-----
Mean bee says: You're mean like me...so you understand that I have to sting you!

-----
Mean bee says: Sorry, but I have to sting you even if you are nice...
p: mean-1, stung-1 //Notice that some people are now stung (1-they got stung and the modification is shown) p2: mean-0, stung-0
p3: mean-1, stung-1
p4: mean-0, stung-1

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education