Answered step by step
Verified Expert Solution
Question
1 Approved Answer
If you are on your own computer, you can load DrJava by following the links on the General Information page. If you are on
If you are on your own computer, you can load DrJava by following the links on the General Information page. If you are on a lab machine, DrJava should be available. Step 2: Writing Some Java Code Reset the interactions pane. In this lab, you will be typing in a method. You can type it directly into the interactions pane. If you get an error, just enter the corrected code. If you get really mixed up, you can reset the interactions pane and try again. Create a method called compareValues that returns a String, and takes two parameters x and y, both of type int. The body of your method should be a large comparison statement that does the following. If x is larger than y, it should return the string "x is larger than y" with x and y in the string replaced with the values of x and y. (Recall the operator for String concatenation.) If y is larger than x, it should return the string "y is larger than x", again with x and y replaced by the values of x and y. Finally, of x and y have the same value, it should return the string "the two values are equal" Test your code by calling compareValues three times, once with x larger than y, once with y larger than x, and once with the values the same to verify that you get the correct response each time.
Step by Step Solution
★★★★★
3.47 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Program Program to be saved as TestCompareValuesjava public class TestCo...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