Description: likes sports is rated as 7 Description: likes beaches is rated as 0 What is your rating for likes sports? P

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Description: likes sports is rated as 7 Description: likes beaches is rated as 0 What is your rating for likes sports? P

Post by answerhappygod »

Description Likes Sports Is Rated As 7 Description Likes Beaches Is Rated As 0 What Is Your Rating For Likes Sports P 1
Description Likes Sports Is Rated As 7 Description Likes Beaches Is Rated As 0 What Is Your Rating For Likes Sports P 1 (69.81 KiB) Viewed 27 times
Description: likes sports is rated as 7 Description: likes beaches is rated as 0 What is your rating for likes sports? Please enter an integer from 1 to 10 9 Displaying the rating we got: Description: likes sports is rated as 9 Description: likes sports is rated as 9 What is your rating for likes beaches? Please enter an integer from 1 to 10 15 Sorry, that rating is out of range. Please enter an integer from 1 to 10 5 Displaying the rating we got: Description: likes beaches is rated as 5 Description: likes beaches is rated as 5
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 1. 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. 2. Write another constructor that sets the rating to a given rating (if it is valid - call the isValid method) and sets the description to "No description yet" to indicate that it has not yet been determined. 3. Write another constructor that sets both description and rating to a given description and rating (if it is valid). 4. Write a private method isValid (aRating) that returns true if the given rating is valid, that is, is between 1 and 10. 5. Write a method setRating that reads a rating from the keyboard, insisting that the rating supplied by the user be valid. 6. Write a toString method that return the description and rating. 7. Write suitable accessors and mutators methods. A sample output of the program is given below:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply