Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class called DateProfile that has the following private instance member

ID: 3640218 • Letter: C

Question

Create a class called DateProfile that has the following private instance members:

Each object in the DateProfile class represents an applicant's profile. If the object is ('M', 'F', 7, 4, "Hugh Hefner") then the applicant's name is "Hugh Hefner", he's looking for a date who is Female, with romance being somewhat important (7) and finance being less important (4).

You should supply all of the following member functions of class DateProfile (at a minimum):

Except for possibly accessors which have single statements, all methods must be defined after the class prototype and not in-line within the class prototype. See modules for examples of this.

From your sample main() that tests your class, you should instantiate a total of 4 DateProfile objects, applicant1, ... applicant4 manually from literal values in your program, i.e., do not involve the user with run-time input. Then for each of the four applicants, display the fits with the others - including themselves. Do this by showing the name of the applicant, then the names and fit values of all applicants relative to this one applicant. Repeat this list for all four applicants producing 16 comparison figures grouped into four groups of four each. (You will be comparing each applicant to his/herself in each of these four groups. This will serve to check whether the result is correct - it must be either a 1 or a 0 depending on the search_gender they requested, but never a number between (can you see why?)). Here is part of a sample output:

Make sure all mutators, constructors and other methods that affect private data adequately test for illegal values and, if possible, return a boolean that reports the results of this test..

Explanation / Answer

I didn't do any of the data checking (you can do that, its pretty simple, just kinda time consuming :P) But everything else works great. It's all in just one file right now, so you can split it up into a .cpp and .h if you want to. Hope it helps! #include #include #include using namespace std; class DateProfile { private: char gender; char search_gender; int romance; int finance; string name; public: //default ctor DateProfile() : gender('M'), search_gender('F'), romance(5), finance(5), name("John Doe") {} //5 param-ctor DateProfile(char g, char s, int r, int f, string n) : gender(g), search_gender(s), romance(r), finance(f), name(n) {} //Getter functions char getGender() { return gender; } char getSearchGender() { return search_gender; } int getRomance() { return romance; } int getFinance() { return finance; } string getName() { return name; } //Setter functions void setGender(char g) { gender = g; } void setSearchGender(char s) { search_gender = s; } void setRomance(int r) { romance = r; } void setFinance(int f) { finance = f; } void setName(string n) { name = n; } double FitValue(DateProfile partner) { return DetermineGenderFit(partner) * DetermineRomanceFit(partner) * DetermineFinanceFit(partner); } double DetermineGenderFit(DateProfile partner) { if(gender == partner.getSearchGender() && search_gender == partner.getGender()) return 1.0; else return 0.0; } double DetermineRomanceFit(DateProfile partner) { double difference = (romance - partner.getRomance()); if(difference < 0) { difference *= -1; } //Swap the sign if negative return (10-difference)*0.1; } double DetermineFinanceFit(DateProfile partner) { double difference = (finance - partner.getFinance()); if(difference < 0) { difference *= -1; } //Swap the sign if negative return (10-difference)*0.1; } }; int main() { //Initiate 4 objects DateProfile J('M', 'F', 10, 3, "Jacob Murmur"); DateProfile R('M', 'F', 3, 9, "Richy Rich"); DateProfile A('F', 'M', 8, 6, "Ashley Blop"); DateProfile G('F', 'M', 2, 9, "Gina Golddigger"); //Display them all cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote