Complete and fully test the class characteristic that


Question:

Part -1:
Complete and fully test the class Characteristic that Exercise explains. Include the given methods:
• getDescription - returns the description of this characteristic
• getRating - returns the rating of this characteristic
• getCompatability(Characteristic otherRating) - returns the compatibility measure of two matching characteristics, or zero if the descriptions do not match
• getCompatibilityMeasure(Characteristic otherRating) - a private method that returns a compatibility measure as a double value using the formula:
• [m = 1 - (r1 - r2)*(r1 - r2)/81]
When both ratings are nonzero; m is zero if either rating is zero.
• isMatch(Characteristic otherRating) - a private boolean method that returns true if the descriptions match
You have to write the given methods and implement these methods in program.

Part 2:
Suppose a class Characteristic that will be used in an online dating service to assess how compatible two people are. Its attributes are
• description - a string that identifies the characteristic
• rating - an integer between 1 and 10 that indicates a person's desire for this characteristic in another person
• Prepare a constructor that sets the description of the characteristic to a given string and sets the rating to zero to indicate that it has not yet been determined
• Prepare a private method isValid(aRating) that returns true if the given rating is valid, that is, is between 1 and 10
• Write a method setRating(aRating) that sets the rating to aRating if it is valid
• Write a method setRating() that reads a rating from the keyboard, insisting that the rating supplied by the user be valid
Testing Your Code
Implement a class named Dating Service that instantiates two people, Chris and Pat, and tests their compatibility by using all of the methods you have defined.
PLEASE ensure it compiles and write the full program to receive full credit. Thank you so much for your help.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Complete and fully test the class characteristic that
Reference No:- TGS0959815

Expected delivery within 24 Hours