Write a class IntegerMath with a single method that takes three integers as para
ID: 3529008 • Letter: W
Question
Write a class IntegerMath with a single method that takes three integers as parameters. Use if and else to select and return only the largest of the three integers. Make sure that your program does a maximum of two numeric comparisons before returning the answer. Test. Hint: you may have more than two comparisons in your program, but only two may be executed. Hint 2: what are all the things you know after the first comparison? Start by writing a method stub - it has no internal code except a return statement so that it compiles (you can tell it to return zero). Then use Eclipse to automagically generate a JUnit4 test class for IntegerMath. Next, fill in the method provided with assertEquals statements that will tell you if your method is correct. How many will you need to be sure?3 Write the method itself (choose a meaningful name!). Make sure your tests all pass, then write another class, IntegerMathMain, where you use your method to create and print three statements of the formExplanation / Answer
class IntegerMath { int large (int a, int b, int c) { if (a>b) {if (a>c) {return a; }else {return c;}}else {if (b>c) {return b;}else {return c} }}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.