Question
In a file called Drill4.java, write a class Drill4 with the following methods (you may find some Math methods in the Java documentation useful): phaseOfWater
In a file called Drill4.java, write a class Drill4 with the following methods (you may find some Math methods in the Java documentation useful): phaseOfWater which takes an int and returns "vapor" if the number is greater than or equal to 100, "liquid" if the number is less than 100 and greater than 0, and "solid" if the number is less than or equal to 0. maxDifference which takes three ints and returns the largest absolute difference between any two of them. For example, maxDifference applied to 1, -1, and 5 should return 6 because the difference between -1 and 5 is 6 which is greater than 2 or 4 (the differences between -1 and 1, and between 1 and 5). ringArea which takes two doubles representing the radius of an inner circle and an outer circle, and returns the area of the ring between them as a double. Assume both inputs are positive and that the first number is smaller than the second. Recall that the area of a circle is r2. You can use Math.PI, a field conveniently defined for us by Java, as a constant for the value of . In addition, you must write at least three interesting tests for each method above, and include the expected values.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started