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

  • gender- a char, the gender of the applicant ('M' or 'F').
  • search_gender- a char, the gender of desired partner ('M' or 'F'). This is not the gender of the applicant, but of the applicant's requested partner.
  • romance- an int from 1 to 10, indicating the importance of romance to the applicant.
  • finance- an int from 1 to 10, indicating the importance of finance to the applicant.
  • name- a string indicating the full name of the applicant.

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):

  • Accessorsand Mutators for each field (instance member). For example: char GetGender() and bool SetGender(char gdr).
  • Constructorsthat take no parameters (default) and all 5 parameters.
  • double FitValue(DateProfile partner), which returns a number from 0.0 (very bad fit) to 1.0 (perfect fit). The public instance methodcompares the calling object (this) to the object passed as a parameter. This method should call three private methods DetermineGenderFit( ... ), DetermineRomanceFit( ... )and DetermineFinanceFit( ... ), that will be used to return intermediate results for each of the three factors. It should multiply the three intermediate numbers together to get and return the final FitValue.
  • double DetermineGenderFit(DateProfile partner)returns either a 0 or 1 depending on the gender compatibility of the calling object and the passed parameter object. You have to compare gender compatibility completely: i.e., there must be mutual consent on this one!
  • double DetermineRomanceFit(DateProfile partner)returns a number from 0.0 to 1.0 depending on the romance compatibility of the calling object and the passed parameter object. The romance numbers should be highest (1.0) if the two values are equal (both 3, both 5, both 7) and lowest (perhaps a small non-zero value like .1) if their difference is 9.
  • double DetermineFinanceFit(DateProfile partner)returns a number from 0.0 to 1.0 depending on the finance compatibility of the calling object and the passed parameter object. The finance numbers should be highest (1.0) if the two values are equal (both 3, both 5, both 7) and lowest (perhaps a small non-zero value like .1) if their difference is 9.

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: See image.

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.

  • GOTO. Don't use a goto statement, ever. This is not even covered in the Modules, because this statement is so arcane and troublesome that no one teaches it any longer. However, occasionally a student discovers it and tries to use it. Don't.
  • Simplicity.If there is an easy way and a hard way to do something, and you choose the hard way, you will lose a point or more. It is important in programming not to make unnecessary work for yourself or the computer. Always think about the simplest solution to any problem.
  • Single Letter Names.Don't use single letter variable names like a, b, or x for your variables, except in the case of something traditional (like k for a loop counter). The Module lessons have examples.
  • Descriptive Names.Use descriptive names for variables like temperature, dimesor user_guess, not cryptic names like var_1 and var_2.
  • Filtering in Mutators.When you get to class methods called mutators, (Set() methods), you are required to filter out bad data by testing the parameters for legal, expected values.
  • No Error Messages in Mutators.Don't send out error messages to the user (i.e., do not do any input or output) from inside mutatormethods.
  • Mutators Return Bools. Mutators always return either true or false, to indicate to the client whether the set was successful. The client may, or may not, use this information, but the mutator must supply it.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.