Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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 public void 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 (regaredless of the other values) and return theaverage 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 romancecompatibility 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 financecompatibility 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: 0.888889

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 thesearchGender they requested, but never a number between (can you see why?)). Here is part of a sample output:

Fit between Joe Somebody and Joe Somebody: 0 Fit between Joe Somebody and Steve Nobody: 0 Fit between Joe Somebody and Jane Peabody: 0.888889 Fit between Joe Somebody and Helen Anybody: 0.833333 Fit between Steve Nobody and Joe Somebody: 0 Fit between Steve Nobody and Steve Nobody: 0 Fit between Steve Nobody and Jane Peabody: 0.666667 ...

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92020894
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question lessons learned from the mirai botnet attack of

Question: Lessons learned from the Mirai Botnet attack of 2016 • Why was it so much more effective than previous BotNet designs? • What kind of mitigations would you recommend for protection? These two points must be ans ...

Describe a ping of death attack as an attack that causes

Describe a ping of death attack as an attack that causes the victim computer to freeze and malfunction.

Question suppose 4 packets of a message each of l bits

Question : Suppose 4 packets of a message, each of L bits arrive at a switch (router) and traverse a link with rate R bps to the destination. Further, suppose that the link is free when the first packet arrives, and the ...

Question suppose you have a set of n project managers and

Question : Suppose you have a set of N project managers and 2N software engineers. Each project manager is only willing to work with certain software engineers. The software engineers have no preferences. Design an algor ...

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

In my sample database i need to use select statements to

In my sample database I need to use SELECT statements to find the following: 1) Find the full names of supervisors together with the total number of employees directly supervised by each one of them. 2) Find the full nam ...

Assignmentnbspon information systems audit and

Assignment  on Information Systems audit and controls Assignment purpose: Elaborate on the different types of control that are applied in a hospital (Preventive, detective and corrective control). Evaluate the logical an ...

Question suppose we have a b-tree that holds keys and

Question : Suppose we have a B-Tree that holds keys and leaves. There are 100 million data records (N), and they are stored in the leaves (lowest level) of the B-Tree. Each leaf contains 100 data records. The leaves are ...

A for which hypervisors does kali linux offer custom

a. For which hypervisors does Kali Linux offer custom images? What tools must be added to a VirtualBox Kali Linux VM to provide proper integration with the host machine? b. What hypervisor comes already installed in Kali ...

At a certain temp the kp for the decomposition of h2s is

At a certain temp, the Kp for the decomposition of H2S is .883. H2S (g) ----> H2(g) + S (g) Initially, only H2S is present at a pressure of  .181 atm  in a closed container. What is the total pressure in the container at ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As