(Solved Homework): I need help with this C++ project. Thank you very much. KN Question: Assignment: Date Profile C++ (not Java) Class DateProfile

I need help with this C++ project. Thank you very much. KN

Question: Assignment: Date Profile C++ (not Java)

Class DateProfile

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

● gender – a char, the gender of the applicant (‘M’ or ‘F’).

● searchGender – 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).

Create public static constants for: ● All range limits (like MIN_ROMANCE, MIN_NAME_LEN, etc.). These are the limits that the mutators test for.

● All default values (like DEFAULT_GEND, DEFAULT_SEARCH_GEND, DEFAULT_NAME). These are used if the default constructor is called or if a parameter-taking constructor is called but a bad value (out-of-range) is detected. However, they are not used directly in the constructors, as we will find that there are helper methods that do the dirty work for the constructors – see below.

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

● Accessors and Mutators for each field (instance member). For example: char getGender() and bool setGender(char gdr). In addition to individual mutators, create a public void setAll( … ) that takes all five parameters and acts like a mutator, except that it has a void return type, i.e., in this one, you do not have to report bad parameters back to the user, even though you would still filter them out. Also, create a publicvoid setDefaults() that sets all five members to their default values.

● Constructors that take no parameters (default) and all 5 parameters. To avoid code duplication make sure these constructors utilize the above mutators rather than do anything direct assignments or testing.

● double fitValue(DateProfile partner), which returns a number from 0.0 (very bad fit) to 1.0 (perfect fit). The public instance method compares 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 compute the final fit value that it returns by returning a 0 if gender is not compatible (regardless of the other values) and return the average of finance and romance values if gender is compatible.

● double determineGenderFit(DateProfile partner) This private instance method 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! It is used by the public fitValue(), not directly by the client main().

● double determineRomanceFit(DateProfile partner) This private instance method 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. It is used by the public fitValue(), not directly by the client main().

● double determineFinanceFit(DateProfile partner) This private instance method 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. It is used by the public fitValue(), not directly by the client main().

The Client Driver

In addition to main() supply a global scope method of that compares and displays two DateProfile objects:

● void displayTwoProfiles(DateProfile profile1, DateProfile profile2) This method will print the names of the two objects and show the fit value. It’s output for a single call will look like this:

Fit between Joe Somebody and Jane Peabody:


From your main(), you will instantiate a total of four 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 callingdisplayTwoProfiles() for all possible combinations of the four applicants producing 16 comparison figures. (You will be comparing each applicant to him/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 searchGender they requested, but never a number between).

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

Expert Answer


#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdlib.h>
#include <ctype.h>
#include <string>

using namespace std;

const int DISPLAY_PRECISION = 3;

class DateProfile{
char gender;
char searchGender;
double romance;
double finance;
string name;

double determineGenderFit(DateProfile partner);
double determineRomanceFit(DateProfile partner);
double determineFinanceFit(DateProfile partner);

static const double MIN_ROMANCE;
static const double MAX_ROMANCE;
static const double MIN_FINANCE;
static const double MAX_FINANCE;
static const int PARAMETERS_COUNT;
static const int MIN_NAME_LEN;
static const int MAX_NAME_LEN;
static const char DEFAULT_GEND;
static const char DEFAULT_SEARCH_GEND;
static const double DEFAULT_ROMANCE;
static const double DEFAULT_FINANCE;
static const string DEFAULT_NAME;

DateProfile(char gender, char searchGender, double romance, double finance,
string name);

bool setGender(char Gender);
bool setSearchGender(char searchGender);
bool setRomance(double romance);
bool setFinance(double finance);
bool setName(string name);
char getGender();
char getSearchGender();
double getRomance();
double getFinance();
string getName();
void setAll(char gender, char searchGender, double romance, double finance,
string name);
void setDefaults();
double fitValue(DateProfile partner);

const double DateProfile::MIN_ROMANCE = 1;
const double DateProfile::MAX_ROMANCE = 10;
const double DateProfile::MIN_FINANCE = 1;
const double DateProfile::MAX_FINANCE = 10;
const int DateProfile::PARAMETERS_COUNT = 2;
const int DateProfile::MIN_NAME_LEN = 1;
const int DateProfile::MAX_NAME_LEN = 30;
const char DateProfile::DEFAULT_GEND = ‘M’;
const char DateProfile::DEFAULT_SEARCH_GEND = ‘F’;
const double DateProfile::DEFAULT_ROMANCE = 1;
const double DateProfile::DEFAULT_FINANCE = 1;
const string DateProfile::DEFAULT_NAME = “John Doe”;

void displayTwoProfiles(DateProfile profile1, DateProfile profile2);

int main(){
DateProfile applicant1 = DateProfile();
DateProfile applicant2 = DateProfile(‘f’, ‘M’, 1.01, 1.01, “Jane Doe”);
DateProfile applicant3 = DateProfile(‘m’, ‘m’, 8, 5, “Gaytsby”);
DateProfile applicant4 = DateProfile();
applicant4.setAll(‘G’, ‘M’, 2, 5, “Gayman Sachs”);

displayTwoProfiles(applicant1, applicant1);
displayTwoProfiles(applicant1, applicant2);
displayTwoProfiles(applicant1, applicant3);
displayTwoProfiles(applicant1, applicant4);

displayTwoProfiles(applicant2, applicant1);
displayTwoProfiles(applicant2, applicant2);
displayTwoProfiles(applicant2, applicant3);
displayTwoProfiles(applicant2, applicant4);

displayTwoProfiles(applicant3, applicant1);
displayTwoProfiles(applicant3, applicant2);
displayTwoProfiles(applicant3, applicant3);
displayTwoProfiles(applicant3, applicant4);

displayTwoProfiles(applicant4, applicant1);
displayTwoProfiles(applicant4, applicant2);
displayTwoProfiles(applicant4, applicant3);
displayTwoProfiles(applicant4, applicant4);

return 0;

double DateProfile::determineGenderFit(DateProfile partner){
return (searchGender == partner.getGender() &&
gender == partner.getSearchGender());

double DateProfile::determineRomanceFit(DateProfile partner){
return 1 – abs(romance – partner.getRomance()) / (MAX_ROMANCE – MIN_ROMANCE);

double DateProfile::determineFinanceFit(DateProfile partner){
return 1 – abs(finance – partner.getFinance()) / (MAX_FINANCE – MIN_FINANCE);


DateProfile::DateProfile(char gender, char searchGender, double romance,
double finance, string name){

bool DateProfile::setGender(char gender){
if(!(toupper(gender) == ‘M’ || toupper(gender) == ‘F’))
return false;
this->gender = toupper(gender);
return true;

bool DateProfile::setSearchGender(char searchGender){
if(!(toupper(searchGender) == ‘M’ || toupper(searchGender) == ‘F’))
return false;
this->searchGender = toupper(searchGender);
return true;

bool DateProfile::setRomance(double romance){
if(!(romance >= MIN_ROMANCE && romance <= MAX_ROMANCE))
return false;
this->romance = romance;
return true;

bool DateProfile::setFinance(double finance){
if(!(finance >= MIN_FINANCE && finance <= MAX_FINANCE))
return false;
this->finance = finance;
return true;

bool DateProfile::setName(string name){
if(!(name.length() >= MIN_NAME_LEN && name.length() <= MAX_NAME_LEN))
return false;
this->name = name;
return true;

char DateProfile::getGender(){
return gender;

char DateProfile::getSearchGender(){
return searchGender;

double DateProfile::getRomance(){
return romance;

double DateProfile::getFinance(){
return finance;

string DateProfile::getName(){
return name;

void DateProfile::setAll(char gender, char searchGender, double romance, double
finance, string name){

void DateProfile::setDefaults(){
gender = DEFAULT_GEND;

double DateProfile::fitValue(DateProfile partner){
if((int) determineGenderFit(partner))
return (determineRomanceFit(partner) + determineFinanceFit(partner))
return 0;

void displayTwoProfiles(DateProfile profile1, DateProfile profile2){
cout << fixed << setprecision(DISPLAY_PRECISION);
cout << “Person 1 Name: ” << profile1.getName() << endl
<< “Person 2 Name: ” << profile2.getName() << endl
<< “Fit value (0 to 1): ” << profile1.fitValue(profile2) << endl << endl;


sample output:

Order NOW for a 10% Discount
Pages (550 words)
Approximate price: -

Why Us?

Top Quality and Well-Researched Papers

All ourbpapers are written from scratch. In fact, Clients who ask for paraphrasing services are highly discouraged. We have writers ready to craft any paper from scratch and deliver quality ahead of time.

Professional and Experienced Academic Writers

Our writers keeps you posted on your papers progress - providing you with paper outline/draft. You are also at liberty to communicate directly with your writer.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time, in many cases quite ahead of time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.


Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents