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
Math,
1 month ago
CBSE BOARD XII,
1 month ago
Science,
1 month ago
Hindi,
3 months ago
Math,
3 months ago
Social Sciences,
9 months ago
Math,
9 months ago
Physics,
9 months ago