Describe constructor and its characterstics


Problem:

Consider 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 (for instance pets or hair color)
  • Rating-An integer between 1 and 10 (inclusive) that indicates a person's desire for this characteristic in another person

And the following methods:

  1. Write a constructor that sets the description of the characteristic to given String and sets the rating to zero to indicate that it has not yet been determined.
  2. Write a private method isValid(aRating) that returns true if the given rating is valid, that is, it is between 1 and 10
  3. Write a method setRating(aRating) that sets the rating to aRating if it is valid
  4. Write a method setRating() that reads a rating from the keyboard, insisting that the rating supplied by the user is valid
  5. Implement get, and set methods for all attributes.

Implement this class in Java and write a main() method within it to test it.

Please read all the questions carefully and answer them.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Describe constructor and its characterstics
Reference No:- TGS0893802

Expected delivery within 24 Hours