19. Write a program to create a class Larger and overload method maximum() as follows:
(i) int maximum( int nl, int n2 ): to return the largest integer from the arguments
nl and n2, using the ternary operators.
(ii) int maximum( int xl, int x2, int x3 ) : to return the largest integer from the arguments
x1, x2 and x3, using the ternary operators.
Also define a method void ShowLarge() to input the three integers and by passing relevant
parameters to the above overloaded functions, print the largest from two and three integers.
Answers
Answered by
0
Answer:
class larger
{
int maximum( intn1,intn2)
{
int large=(n1> n2)? n1: n2;
return large
}
int maximum ( int x1> x2)? x1:x2
int large 2 ( large1> x3)? large1: x3;
return large 2
}
void show large1
int max (12,34)
int max(34,76,354)
}
}
Similar questions