CS计算机代考程序代写 Control.cc

Control.cc

Control.h

CriteriaArray.cc

CriteriaArray.h

Criteria.cc

Criteria.h

defs.h

View.cc

View.h

#include
using namespace std;
#include

void Control::initShelter()
{
initAnimals();
initClients();
}

void Control::initClients()
{
Client* c;

c = new Client(“Lee”);
c->addCriteria(new Criteria(“Species”, “Dog”));
c->addCriteria(new Criteria(“Gender”, “F”, 8));
c->addCriteria(new Criteria(“Age”, “4”, 2));
shelter->add(c);

c = new Client(“Kara”);
c->addCriteria(new Criteria(“Species”, “Other”));
c->addCriteria(new Criteria(“Breed”, “Guinea Pig”, 9));
c->addCriteria(new Criteria(“Age”, “2”, 1));
shelter->add(c);

c = new Client(“Laura”);
c->addCriteria(new Criteria(“Species”, “Cat”));
c->addCriteria(new Criteria(“Breed”, “Domestic Short Hair”, 2));
c->addCriteria(new Criteria(“Gender”, “M”, 3));
c->addCriteria(new Criteria(“Age”, “1”, 5));
shelter->add(c);
}

void Control::initAnimals()
{
shelter->add(new Animal(C_DOG, “Poodle”, “White”, “Betsy”, “F”, 5));
shelter->add(new Animal(C_DOG, “Labradoodle”, “Tan”, “Killer”, “F”, 3));
shelter->add(new Animal(C_DOG, “German Shepard”, “Black/Tan”, “Fluffy”, “M”, 2));
shelter->add(new Animal(C_DOG, “Pug”, “Tan”, “Leon”, “M”, 4));
shelter->add(new Animal(C_DOG, “Pug”, “Tan”, “Lily”, “F”, 1));
shelter->add(new Animal(C_CAT, “Domestic Short Hair”, “Grey”, “Lady”, “F”, 11));
shelter->add(new Animal(C_CAT, “Domestic Short Hair”, “Grey”, “Shadow”, “M”, 5));
shelter->add(new Animal(C_CAT, “Domestic Long Hair”, “Grey”, “Luka”, “M”, 7));
shelter->add(new Animal(C_CAT, “Domestic Short Hair”, “Grey tabby”, “Fiona”, “F”, 8));
shelter->add(new Animal(C_CAT, “Domestic Short Hair”, “Brown tabby”, “Ruby”, “F”, 5));
shelter->add(new Animal(C_RABBIT, “Lionhead”, “Black”, “Ziggy”, “F”, 3));
shelter->add(new Animal(C_OTHER, “Guinea Pig”, “Black”, “Quark”, “M”, 9));
shelter->add(new Animal(C_OTHER, “Guinea Pig”, “Brown”, “Quasar”, “M”, 1, 4));
shelter->add(new Animal(C_OTHER, “Mouse”, “Tan”, “Pecorino”, “M”, 0, 3));
shelter->add(new Animal(C_OTHER, “Mouse”, “Tan”, “Gruyere”, “M”, 0, 3));
shelter->add(new Animal(C_OTHER, “Mouse”, “Tan”, “Limburger”, “M”, 0, 3));
}

#ifndef CONTROL_H
#define CONTROL_H

class Control
{
public:

private:

};

#endif

#include
using namespace std;

#include “CriteriaArray.h”

CriteriaArray::CriteriaArray() : size(0) {}

CriteriaArray::~CriteriaArray()
{
for (int i=0; i= size)
return NULL;

return elements[index];
}

void CriteriaArray::add(Criteria* c)
{
if (size >= MAX_SIZE) {
cerr<<"Overflow"<print();
}

cout<
using namespace std;
#include
#include

#include “Criteria.h”

Criteria::Criteria(string n, string v, int w)
: name(n), value(v), weight(w) { }

string Criteria::getName() { return name; }
string Criteria::getValue() { return value; }
int Criteria::getWeight() { return weight; }

void Criteria::print()
{
cout << setw(8) << left << name << " " << setw(20) << left << value << " " << setw(2) << right << weight << " " << endl; } #ifndef CRITERIA_H #define CRITERIA_H #include
using namespace std;

class Criteria
{
public:
Criteria(string=””, string=””, int=0);

string getName();
string getValue();
int getWeight();
void print();

private:
string name;
string value;
int weight;
};

#endif

#ifndef DEFS_H
#define DEFS_H

#define MAX_SIZE 128

typedef enum {C_DOG, C_CAT, C_BIRD, C_RABBIT, C_OTHER}
SpeciesType;

#endif

#include
using namespace std;
#include

#include “View.h”

void View::showMenu(int& choice)
{
int numOptions = 3;

cout << endl << endl; cout << "What would you like to do:"<< endl; cout << " (1) Compute matches" << endl; cout << " (2) Print animals" << endl; cout << " (3) Print clients" << endl; cout << " (0) Exit" << endl<> choice;

while (choice < 0 || choice > numOptions) {
cout << "Enter your selection: "; cin >> choice;
}

}

void View::printStr(string str)
{
cout << str; } void View::readInt(int& n) { cin >> n;
}

void View::readStr(string& str)
{
cin >> str;
}

#ifndef VIEW_H
#define VIEW_H

#include
#include
using namespace std;

class View
{
public:
void showMenu(int&);
void printStr(string);
void readInt(int&);
void readStr(string&);
};

#endif

Leave a Reply

Your email address will not be published. Required fields are marked *