Complete and fully test the class characteristic

Assignment Help JAVA Programming
Reference no: EM13706548

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.

Reference no: EM13706548

Questions Cloud

What is the cardinality of an entity : What is the cardinality of an entity - Why is it useful to consider the cardinality when designing a database?
Database design and end-user requirements : How pervasive are conflicts between database design and end-user requirements? Should the two go hand-in-hands?
Process of designing an er diagram : Does the process of designing an ER diagram ever require more than one iteration? Why or why not?
When would a weak relationship be more suitable : When would a weak relationship be more suitable than a strong relationship? Give concrete examples?
Complete and fully test the class characteristic : Complete and fully test the class Characteristic that Exercise explains. Suppose a class Characteristic that will be used in an online dating service to assess how compatible two people are.
Show numbers between those two numbers in ascending order : Ask the user to type two numbers from range 20-60. Keep on asking until he types in the range of 20-60. Show the numbers between those two numbers in ascending order.
How many numbers they want to have from that number : Modify the previous program to ask the user a number to start and how many numbers they want to have from that number.
Number of space characters in a string : Write a loop that counts the number of space characters in a string - You need to implement a program to find the number of spaces.
Convert the unsigned decimal to the indicated base : Convert the unsigned decimal to the indicated base: 34.50 to octal 37.150 to hexadecimal 73.5 to binary

Reviews

Write a Review

JAVA Programming Questions & Answers

  Need usual internal node structure and constructor

Create a basic, generic DataTree class. As described, it will consist of a binary tree structure, and will need the usual internal node structure and constructor -  Write the other methods used in Section One of the commented-out test code in Main..

  Write java program to accept two words as input

Write a Java program that accepts two words as input and determines if one of them is resulting from changing the order of the others' letters.

  Eax contains the given contents before the instruction

For each add instruction in this problem, assume that EAX contains the given contents before the instruction is executed, and give the contents of EAX as well as the values of the CF, OF, SF, and ZF flags after the instruction is executed:

  Method to calculate all primes in the range [2..n]

One commonly used method to calculate all primes in the range [2..n] is to start with the number 2, mark it as prime, and mark all its multiples (excluding itself) as not prime. Then, we find the next smallest unmarked number, mark it as prime, and m..

  Java is considered to be safe from buffer overflows

Java is considered to be safe from buffer overflows. Does that make it more appropriate to use as a s development language when security is concerned? Be sure and weight all if the risks involved in product development, not just the security aspec..

  Java code using jframe

Write a Java code using JFrame. This code needs to manipulate 4 shapes(2 rectangles and 2 squares) in a 400x400 JFrame. This needs to manipulate the shapes in 3 different ways, using 3 different methods. One for translating a shape, one for proportio..

  Your project as a programming consultant is to create a

your project as a programming consultant is to create a program that develops an amortization schedule.nbsp your

  User interface menu using doubly linked lists

Each mNode defines the main menu item name, two links to its mNode neighbors (the previous and next mNode) and a link to its first submenu node.

  Design the appropriate accessor and mutator methods

Design an Employee class that has fields for the following pieces of information: Employee Name Employee Number Next, design a class named ProductionWorker that extends the Employee class.

  Write a program that allows a user to enter a line of text

Write a program that allows a user to enter a line of text, counts number of words and number of vowels in the sentence, and gives the average number of vowels per word in the message

  Alicia creates a button using the code jbutton exit button

Alicia creates a button using the code JButton exitButton = new JButton("exit"); and places it into a JFrame named mainFrame

  A class is a blueprint for an object

A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields.

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