Use the class provided, TestOverloadCall printMax to print the highest of 33 and 89Call printMax to print the highest of 55, 11, 99Submit, a print screen of the code and the output public class TestOverload {public static void main(String[] args) {//Call printMax to print the highest of 33 and 89//Call printMax to print the highest of 55, 11, 99}public static void printMax (int num1, int num2){if (num1 > num2)System.out.println("The highest is " + num1);elseSystem.out.println("The highest is " + num2);}//End of printMaxpublic static void printMax (int num1, int num2, int num3){if (num1 > num2 && num1 > num3)System.out.println("The highest is " + num1);else if (num2 > num1 && num2 > num3 )System.out.println("The highest is " + num2);elseSystem.out.println("The highest is " + num3);}//End of printMax}//End of TestOverload
Use the class provided, TestOverload
Call printMax to print the highest of 33 and 89
Call printMax to print the highest of 55, 11, 99
Submit, a print screen of the code and the output
public class TestOverload {
public static void main(String[] args) {
//Call printMax to print the highest of 33 and 89
//Call printMax to print the highest of 55, 11, 99
}
public static void printMax (int num1, int num2)
{
if (num1 > num2)
System.out.println("The highest is " + num1);
else
System.out.println("The highest is " + num2);
}//End of printMax
public static void printMax (int num1, int num2, int num3)
{
if (num1 > num2 && num1 > num3)
System.out.println("The highest is " + num1);
else if (num2 > num1 && num2 > num3 )
System.out.println("The highest is " + num2);
else
System.out.println("The highest is " + num3);
}//End of printMax
}//End of TestOverload
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images