All programming assignments should include the name, or names, of the
students. This information should be placed in the introductory comments
section. The introductory comments should also contain the purpose of the
program. Clear, concise, commenting is an important skill to develop and
will be part of the grade for each program. Programs should be submitted
via Blackboard as “.cpp” source programs. Each member of a team should
submit a copy of the program.
The purpose of PSA 7 is practice our programming style and techniques on
a fairly simple real world example of an application. PSA7.cpp is a program
that analyzes various aspects of the clients at an animal shelter. Your task
is to fill in the three routines that provide the necessary information to the
main routine. You may not alter the code in main. You must use the
interfaces as defined.
The first two routines are almost trivial and the only thing that is special
about one of them is the need to use a persistent variable.
The third one, shotRecord is a bit challenging. You must determine if each
animal has had the correct shots. These are for Parvovirus, Rabies, and
Bordetella. One confusion factor here is that they could have also received
a shot for Leptospirosis; that is not a required shot. Further complicating
things is the fact that the only thing that is important is that they received
the shot; they may have received their inoculations in differing orders.
Programme it using \"CODE::BLOCK and also use the main function below:
#include
#include
#include
#include
using namespace std;
#define numberSpecies 4
#define numberShots 3
enum species {dog, cat, bird, rabbit};
enum shots {Parvovirus, Rabies, Bordetella, Leptospirosis};
string outString;
struct animal
{
string name;
unsigned int stay;
enum species animalType;
enum shots status[numberShots];
};
int displayAnimal(struct animal *animal)
{
cout << \"Name:\\t\\t\" << animal->name << endl;
cout << \"Species:\\t\";
switch (animal->animalType)
{
case dog:
cout << \"Dog\";
break;
case cat:
cout << \"Cat\";
break;
case bird:
cout << \"Bird\";
break;
case rabbit:
cout << \"Rabbit\";
break;
default:
cout << \"Unknown\";
}
cout << endl;
cout << \"Length of stay: \" << animal->stay << endl << endl;
return 0;
}
double averageStay(struct animal *animal)
{
// Your code goes here.
// Hint you will need to use a type we have not used before.
}
int countPopulation(struct animal census[], enum species kindAnimal, unsigned int k)
{
unsigned int j, animalCount;
// Your code goes here.
return animalCount;
}
bool shotRecord(struct animal *animal)
{
unsigned int temp, m, shot;
temp = 0;
// Your code goes here.
// This is the trickiest one!
return (temp == 3) ? true: false;
}
int main()
{
#define censusSize 6
struct animal census[censusSize];
census[0].animalType = dog;
census[0].name = \"Fred\";
census[0].stay = 13;
census[0].status[0] = Rabies;
census[0].status[1] = Bordetella;
census[0].status[2] = Parvovirus;
census[1].animalType = cat;
census[.
All programming assignments should include the name, or names, of th.pdf
1. All programming assignments should include the name, or names, of the
students. This information should be placed in the introductory comments
section. The introductory comments should also contain the purpose of the
program. Clear, concise, commenting is an important skill to develop and
will be part of the grade for each program. Programs should be submitted
via Blackboard as “.cpp” source programs. Each member of a team should
submit a copy of the program.
The purpose of PSA 7 is practice our programming style and techniques on
a fairly simple real world example of an application. PSA7.cpp is a program
that analyzes various aspects of the clients at an animal shelter. Your task
is to fill in the three routines that provide the necessary information to the
main routine. You may not alter the code in main. You must use the
interfaces as defined.
The first two routines are almost trivial and the only thing that is special
about one of them is the need to use a persistent variable.
The third one, shotRecord is a bit challenging. You must determine if each
animal has had the correct shots. These are for Parvovirus, Rabies, and
Bordetella. One confusion factor here is that they could have also received
a shot for Leptospirosis; that is not a required shot. Further complicating
things is the fact that the only thing that is important is that they received
the shot; they may have received their inoculations in differing orders.
Programme it using "CODE::BLOCK and also use the main function below:
#include
#include
#include
#include
using namespace std;
#define numberSpecies 4
#define numberShots 3
enum species {dog, cat, bird, rabbit};
enum shots {Parvovirus, Rabies, Bordetella, Leptospirosis};
string outString;
struct animal
{
2. string name;
unsigned int stay;
enum species animalType;
enum shots status[numberShots];
};
int displayAnimal(struct animal *animal)
{
cout << "Name:tt" << animal->name << endl;
cout << "Species:t";
switch (animal->animalType)
{
case dog:
cout << "Dog";
break;
case cat:
cout << "Cat";
break;
case bird:
cout << "Bird";
break;
case rabbit:
cout << "Rabbit";
break;
default:
cout << "Unknown";
}
cout << endl;
cout << "Length of stay: " << animal->stay << endl << endl;
return 0;
}
double averageStay(struct animal *animal)
{
// Your code goes here.
// Hint you will need to use a type we have not used before.
}
int countPopulation(struct animal census[], enum species kindAnimal, unsigned int k)