Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need help with a computer science program , here is the code we have been given. we need to create some constructors and a couple
need help with a computer science program , here is the code we have been given. we need to create some constructors and a couple of parameterized constructors
here is what we have so far, just need hlep with the constructors and couple of parameterized constuctors. no modifications to the main function need to be made
int main() { //step 1: set up dog class, implement default constructors dog bonny; dog wimpy; //step 2: set two different parameterized constructors dog fido("rottweiler", 200); dog snuffles(15); //step 3: create "set" methods bonny.setBreed("pit bull"); bonny.setWeight(500); wimpy.setWeight(-300); //step 4: create a speak method bonny.speak(); //I'm a 500 lbs pit bull wimpy.speak(); //I'm a 0 lbs mutt fido.speak(); //I'm a 200 lbs rottweiler snuffles.speak(); //I'm a 15 lbs mutt //step 5: switch bodies! bonny.switchBodies(fido); bonny.speak(); //I'm a 200 lbs rottweiler fido.speak(); //I'm a 500 lbs pit bull //step 6: love is in the air dog puppy; puppy = fido.mateWith(wimpy); puppy.speak(); //I'm a 250 lbs pit bull-mutt //step 7: uh oh, they're fighting... puppy.bite(fido); puppy.speak(); //I'm a 260 lbs pit bull-mutt fido.speak(); //I'm a 490 lbs pit bull-mutt //step 8: let's feed that puppy puppy++; puppy.speak(); //I'm a 360 lbs pit bull-mutt return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started