Create a class called dateprofile

Assignment Help JAVA Programming
Reference no: EM131596852

Assignment - Computer Dating

Make sure you have read and understood bothmodules AandBthis week, and module 2R

Requirements before submitting this assignment. Hand in only one program, please.

Date Profiles
Class DateProfile
Create a class called DateProfile that has the following private instance members:
gender- achar, the gender of the applicant ('M' or 'F').
searchGender- achar, the gender of desired partner ('M' or 'F'). This is not the gender of the applicant, but of the applicant's requested partner.
romance- anintfrom 1 to 10, indicating the importance of romance to the applicant.
finance- anintfrom 1 to 10, indicating the importance of finance to the applicant.
name- aStringindicating 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 (likeMIN_ROMANCE,MIN_NAME_LEN, etc.). These are the limits that the mutators test for.

All default values (likeDEFAULT_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):

AccessorsandMutatorsfor each field (instance member). For example:char getGender()andboolean setGender(char gdr). In addition to individual mutators, create a publicvoid 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.

Constructorsthat take no parameters (default) and all 5 parameters. To avoid code duplication make sure that the parameter-taking constructor utilizes 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). Thepublic instance method compares the calling object (this) to the object passed as a parameter. This method should call threeprivatemethods 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 theaverageof finance and romance values if gender is compatible.

double determineGenderFit(DateProfile partner) Thisprivate 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 bemutualconsent on this one! It is used by the public fitValue(), not directly by the client main().

double determineRomanceFit(DateProfile partner) Thisprivate instance method returns a number from (but not including) 0.0 to (and including) 1.0 depending on theromancecompatibility of the calling object and the passed parameter object. Theromancenumbers 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) Thisprivate instance method returns a number from (but not including) 0.0 to (and including) 1.0 depending on thefinancecompatibility of the calling object and the passed parameter object. Thefinancenumbers 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().

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.

DateProfile should be a class distinct from (and not contained within) your main class (which we call Foothill). However, you can and should define it as a non-public class so it can reside in the same file, Foothill.java.

The Client Driver
In addition to main() supply a static method of class Foothill that compares and displays two DateProfileobjects:
static 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 Sarah Somebody and Jane Peabody: 0.395

From your main() inside Foothill, 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 calling displayTwoProfiles() 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 (can you see why?)). Here is part of a sample output (with an optional mutator test at the end):

Fit between Sarah Somebody and Sarah Somebody: 1.0
Fit between Sarah Somebody and Steve Nobody: 0.0
Fit between Sarah Somebody and Jane Peabody: 0.395
Fit between Sarah Somebody and Helen Anybody: 0.0

Fit between Steve Nobody and Sarah Somebody: 0.0
Fit between Steve Nobody and Steve Nobody: 0.0
Fit between Steve Nobody and Jane Peabody: 0.0
Fit between Steve Nobody and Helen Anybody: 0.78

Fit between Jane Peabody and Sarah Somebody: 0.395
Fit between Jane Peabody and Steve Nobody: 0.0
Fit between Jane Peabody and Jane Peabody: 1.0
Fit between Jane Peabody and Helen Anybody: 0.0

Fit between Helen Anybody and Sarah Somebody: 0.0
Fit between Helen Anybody and Steve Nobody: 0.78
Fit between Helen Anybody and Jane Peabody: 0.0
Fit between Helen Anybody and Helen Anybody: 0.0

Q rejected as gender

...

Reference no: EM131596852

Questions Cloud

A brief statement regarding the author and his credentails : A brief statement regarding the author and his or her credentials as an authority.A concise statement regarding the relevance of the article for your topic.
Write a response to children need to play not compete : Write a 1 ½ to 2 page response to Children Need to Play, Not Compete. Before you even begin drafting, you will want to decide on the terms of your response.
Describe the interface and ux criteria : Before you learn how to use web-authoring software to design, edit, and update web-based content, you need to understand basic concepts.
Determining the homeowners insurance : Karen, a first time home buyer, just bought a previously owned townhouse. Discuss two (2) factors that Karen should consider as she purchases.
Create a class called dateprofile : Create a class called DateProfile that has the following private instance members - Create public static constants
Explain the five different types of intercultural adaptation : Explain five different types of intercultural adaptation. Which ones do you think will be important to you as you continue to become intercultural communicator?
What is jane net capital gain for the current year : Jane has a carried forward net capital loss of $1,000 made on some shares she sold last year. What is Jane's net capital gain for the current year
How can one truly set a price on keeping an infant alive : How can one truly set a price on keeping an infant alive or giving a paralyzed patient another chance at walking again?
Write a method to compute the average of an int array : Write a method to compute the average of an int array and return the value as a double. The int array and the number of elements in the array

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a pair of programs a client and a server to

create a pair of programs a client and a server to distribute the functions of the library you developed. the client

  Write down a java program that implements a stack of

write a java program which implements a stack of integers. an integer should only be pushed into the stack if it is

  Method that accepts a string object

Word Counter Write a method that accepts a String object as an argument and returns the number of words it contains. For instance, if the argument is "Four score and seven years ago" the method should return the number

  Problem regarding the actor computing

The actor mail system provides asynchronous buffered communication and does not guarantee that messages (tasks in actor terminology) are delivered in the order they are sent. Suppose actor A sends tasks t1, t2, t3,... , to actor B and we want acto..

  Implementing the tic tac toe game

Write a graphical Java program implementing the Tic Tac Toe game - The program should play against a user. The user + program should start the game on alternate games.

  Write a java program that repeatedly enters a date

Write a Java Program that repeatedly enters a date and prints the day of the week that corresponds to each input date. Use a Calendar class object to find the day of week.

  Calculate the additional amount of sales

Calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners - The application should ask for the name of each salesperson being compared.

  Explain the meaning of polymorphism

Explain the meaning of polymorphism

  Explain security and permissions for the android platform

Briefly explain security and permissions for the Android Platform. Briefly describe some of the Android Platform Services. Describe the Android Platform Differences (complete, open, and free).

  Writing a method to compute such an array from a string

Write a java program in one file to determine if a string is an anagram of another string where a typical run of your program is to be as follows. % java Assg3 restful fluster"restful" is an anagram of "fluster"

  Create a class named employee and its subclasses

Create a class named Employee and its 3 subclasses named Contractor, HourlyEmployee, FullTimeEmployee. The class Employee hold first name and last name information, and defines two methods, respectively computing pay and vacation hours, that needs..

  Implement a fishlake simulation similar to the previous

implement a fishlake simulation similar to the previous assignment. you will then make adjustments to accommodate class

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