Problem

Consider a class Characteristic that will be used in an online dating service to assess ho...

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

• rating—an integer between 1 and 10 that indicates a person’s desire for this characteristic in another person

a. Write 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.


b. Write a private method isValid(aRating) that returns true if the given rating is valid, that is, is between 1 and 10.


c. Write a method setRating(aRating) that sets the rating to aRating if it is valid.


d. Write a method setRating that reads a rating from the keyboard, insisting that the rating supplied by the user be valid

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT