Create a class called dateprofile that has instance members

Assignment Help Computer Engineering
Reference no: EM131266141

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.

Reference no: EM131266141

Questions Cloud

Implement and test a generic binary search : Implement and test a generic binary search. Note that your test program must use at least 2 types of data to prove that bsearch is generic.
What are the major barriers to international trade : What are the major barriers to international trade? Explain how government policies may be used to either restrict or stimulate global marketing.
Accompanying consolidated balance sheets : Rowe Price Group, IncWe have audited the accompanying consolidated balance sheets of T. Rowe Price Group, Inc and subsidiaries (the Company) as of December 31, 2010 and 2009, and the related consolidated statements of income, stockholders' equity,..
Draw a domain concept diagram for the abt : Select one of the predictive analytics models that you proposed in your answer to the previous question about the oil exploration company for exploration of the design of its analytics base table.
Create a class called dateprofile that has instance members : Create a class called DateProfile that has the following private instance members: gender - a char, the gender of the applicant ('M' or 'F').
Demand for international reserves : 1. Analyze the following statement: "The demand for international reserves tend to increase with the level of world income and trade activity."
Describe the domain concepts for this abt : Are there likely to be any legal issues associated with the domain concepts you have included?
Market fail in the presence of an externality : a.) It is possible for an activity to have both positive and negative externality. Identify three activities that result in both positive and negative externality and carefully explain the positive and negative externality that results. b.) Why do..
What amount should nasa report as a balance : During 2012, NASA Co. produced a new line of computers that carry a three-year warranty against manufacturer's defects. What amount should NASA report as a balance of the Warranty Liability account at December 31, 2014

Reviews

Write a Review

Computer Engineering Questions & Answers

  Data mining and data mining tools

Describe the data mining and explain the several data mining tools available to the business. Explain the data Warehouse and specify the key attributes of the data warehouse.

  How java programing benefits to nonprogrammers

How does knowledge of programming concepts benefit individuals working in any IT position.

  Draw the timing diagram for a digital signal

Draw the timing diagram for a digital signal that continuously alternates between 0.2 V (binary 0) for 2 ms and 4.4 V (binary 1) for 4 ms.

  Define the way for creating work breakdown structure

Define the way for creating work breakdown structure Use a hypothetical project to illustrate your understanding of the WBS.

  Determine number of gate that can be enclosed in one package

TTL SSI come mostly in 14-pin packages. Two pins are reserved for power and the other 12 pins are used for input and output terminals. Determine the number of gates that can be enclosed in one package.

  Questiondeveloping requests specification for this

questiondeveloping requests specification for this integration. you have to use all of tools available to you to elicit

  Write down an e-mail explaining the five elements of

imagine you have been hired by a small well-funded startup company to help with their it-enabled business strategy.

  Design simplified and shared dynamic ram controller circuit

Design a simplified and shared dynamic RAM controller circuit which has the following specifications. The inputs to the circuit are a 20 bit address (ADDRIN), a read signal (RD), a write signal (WR), and an enable signal (ALE).

  How the second decision is made entirely

When a calculation could be performed once before entering a loop, it is inefficient to place the calculation within the loop.

  Explain what is the order of the calls to the constructor

Given the following class inheritance structure, what is the order of the calls to the constructor if an object of class derived 2 is declared

  Describe policies standards processes and guidelines

Describe Policies, Standards, Processes and Guidelines. Discuss the relationship between Controls and Audits. The Sarbanes-Oxley Act. The different implications Regulations have on Government and non-Government entities.

  How many bits are there in the operation code

How many bits are there in the operation code, the register code part, and the address part? Draw the instruction word format and indicate the number of bits in each part.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd