CIS247 Week 5 Lab The following problem should be created as a project in Visual Studio, compiled and debugged. Be sure to add a header to your code and properly document the code. Copy your code into...

1 answer below »
what is the prce


CIS247 Week 5 Lab The following problem should be created as a project in Visual Studio, compiled and debugged. Be sure to add a header to your code and properly document the code. Copy your code into a Word document named with your last name included such as: CIS247_Lab5_Smith. Also include screen prints of your test runs. Submit this Word document and the project file (zipped). This is a problem using class inheritance and polymorphism. The New Friend pet adoption agency handles only dogs and cats. This is how they keep track of their stock. We will have the following 5 classes: Base Class: Pet Derived from Pet: Cat, Dog Derived from Dog: DogAdoptee Derived from Cat : CatAdoptee Pet Dog Cat DogAdoptee CatAdoptee Use these UML diagrams to code your classes; note: the # symbol means Protected access. Pet #size : string //possible values are small, medium, large #age : string //possible values are young, adult, senior #gender : char //possible values are M or F +Pet() +Pet(sz : string, a : string, gen: char) +printInfo() : void//print pet’s information including size, age and gender (Hint: you will need an if statement to print “male” when gender == ‘M’) Dog #breed: string //this could be any breed or mixed breed #houseTrained : bool //true or false +Dog() +Dog(sz : string, a : string, gen : char, brd : string, trained : bool) +setBreed(brd : string) : void +getBreed() : string +setTrained(trained : bool) : void +getTrained() : bool +printInfo() : void//print Pet information and information about breed and whether house trained Cat #hairLength : string //values can be long, medium or short #otherCats : bool //true or false on whether it gets along with other cats in the house +Cat() +Cat(sz : string, a : string, gen : char, hair : string, other : bool) +setHairLength(hair : string) : void +getHairLength() : string +setOtherCats(other : bool) : void +getOtherCats() : bool +printInfo() : void//print Pet information along with hair length and whether it gets along with other cats DogAdoptee -name : string -activityLevel : string //values can be high, medium, low DogAdoptee() DogAdoptee(sz : string, a : string, gen : char, brd : string, trained : bool, nm : string, activity : string) +setName(nm : string) : void +getName() : string +setActivity(activity : string) : void +getActivity() : string +printInfo() : void//print all Pet and Dog information along with name and activity level CatAdoptee -name : string -personality : string //values can be cuddly, playful or shy +CatAdoptee() +CatAdoptee(sz : string, a : string, gen : char, hair : string, other : bool, nm : string, pers : string) +setName(nm : string) : void +getName() : string +setPersonality(pers : string) : void +getPersonality() : string +printInfo() : void//print all Pet and Cat information along with name and personality Code all five classes using header files and putting member function code into separate .cpp files. Be sure to indicate inheritance when you code the header files for Dog, Cat, DogAdoptee and CatAdoptee. Be sure to include the proper header files where needed. NOTES: · The constructors of your derived classes should include the parents’ attributes and the current class attributes. Use the parent’s constructor for the parent’s attributes as shown in the Exercise. · Your printInfo() methods should call the parent’s printInfo() and add any unique information. No redundant print statements allowed! Use inheritance. · When printing information on booleans, use an if statement: if (houseTrained) cout < “this="" dog="" is="" housetrained”="">< endl;="" else="" cout="">< “this="" dog="" is="" not="" housetrained”="">< endl; in the main function: create a dogadoptee named “pugster” that is a medium activity pug who is housetrained. he is considered a small, young male. print all pugster’s information with one printinfo() call using the dogadoptee object. create a catadoptee named “holly” that is a cuddly long-haired cat that gets along with other cats well. holly is a small adult female cat. print all holly’s information with one printinfo() call. here is some example output; your should be similar but need not be identical: submitting your assignment please copy all 11 files of code into a word document. paste in a screenshot of your running program. submit the word document and the complete zipped project folder. endl;="" in="" the="" main="" function:="" create="" a="" dogadoptee="" named="" “pugster”="" that="" is="" a="" medium="" activity="" pug="" who="" is="" housetrained.="" he="" is="" considered="" a="" small,="" young="" male.="" print="" all="" pugster’s="" information="" with="" one="" printinfo()="" call="" using="" the="" dogadoptee="" object.="" create="" a="" catadoptee="" named="" “holly”="" that="" is="" a="" cuddly="" long-haired="" cat="" that="" gets="" along="" with="" other="" cats="" well.="" holly="" is="" a="" small="" adult="" female="" cat.="" print="" all="" holly’s="" information="" with="" one="" printinfo()="" call.="" here="" is="" some="" example="" output;="" your="" should="" be="" similar="" but="" need="" not="" be="" identical:="" submitting="" your="" assignment="" please="" copy="" all="" 11="" files="" of="" code="" into="" a="" word="" document.="" paste="" in="" a="" screenshot="" of="" your="" running="" program.="" submit="" the="" word="" document="" and="" the="" complete="" zipped="" project="">
Answered Same DayAug 20, 2021

Answer To: CIS247 Week 5 Lab The following problem should be created as a project in Visual Studio, compiled...

Piyush answered on Aug 24 2021
152 Votes
cat.cpp
#include "cat.h"
cat::cat():pet(){
hairlength = "Normal";
otherCats = false;
}
cat::cat(string sz, string a, char gen, string hair, bool other):pet(sz,a,gen){
hairlength = hair;
otherCats = other;
}
void cat::setHairLength(string hair){
hairlength = hair;
}
string cat::getHairLength(void){
return hairlength;
}
void cat::setOtherCats(bool other){
otherCats = other;
}
bool cat::getOtherCats(void){
return otherCats;
}
void cat::printInfo(void){
pet::printInfo();
cout<<"The cat hairlength is:\t"< if(otherCats == true){
cout<<"The cat is like other cats"< }else{
cout<<"The cat is not like other cats"< }
}
cat.h
#ifndef __CAT_H__
#define __CAT_H__
#include "pet.h"
class cat:public pet{
protected:
string hairlength;
bool otherCats;
public:
cat();
cat(string sz, string a, char gen, string hair, bool other);
void setHairLength(string hair);
string getHairLength(void);
void setOtherCats(bool other);
bool getOtherCats(void);
void printInfo(void);
};
#endif // __CAT_H__
catadoptee.cpp
#include "catadoptee.h"
catadoptee::catadoptee():cat(){
name = "Meow";
personality = "nice";
}
catadoptee::catadoptee(string sz, string a, char gen, string hair, bool other, string nm, string pers):cat(sz,a,gen,hair,other){
name = nm;
personality = pers;
}
void catadoptee::setName(string nm){
name = nm;
}
string catadoptee::getName(void){
return name;
}
void catadoptee::setPersonality(string pers){
personality = pers;
}
string catadoptee::getPersonality(void){
return personality;
}
void catadoptee::printInfo(void){
cat::printInfo();
cout<<"The cat name is:\t"< cout<<"The cat personality is:\t"<}
catadoptee.h
#ifndef __CATADOPTEE_H__
#define __CATADOPTEE_H__
#include "cat.h"
class catadoptee:public cat{
protected:
string name;
string personality;
public:
catadoptee();
catadoptee(string sz, string a, char gen, string hair, bool other, string nm, string pers);
void setName(string nm);
string getName(void);
void setPersonality(string pers);
string getPersonality(void);
void printInfo(void);
};
#endif // __CATADOPTEE_H__
dog.cpp
#include "dog.h"
dog::dog():pet(){
breed = "BullDog";
housetrained = true;
}
dog::dog(string sz, string a, char gen, string brd, bool trained):pet(sz,a,gen){
breed = brd;
housetrained = trained;
}
void dog::setBreed(string brd){
breed = brd;
}
string dog::getBreed(void){
return breed;
}
void dog::setTrained(bool Trained){
housetrained = Trained;
}
bool dog::getTrained(void){
return housetrained;
}
void dog::printInfo(void){
pet::printInfo();
cout<<"The breed of the dog is:\t"< if(housetrained == true){
cout<<"The pet is house trained"< }else{
cout<<"The pet is not house trained"< }
}
dog.h
#ifndef __DOG_H__
#define __DOG_H__
#include "pet.h"
class dog:public pet{
protected:
string breed;
bool housetrained;
public:
dog();
dog(string sz, string a, char gen, string brd, bool trained);
void setBreed(string brd);
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here