Computer Science, asked by rudrakshadutta75, 9 months ago

Write a program to perform the following task using the concept of function overloading void compute ( int m , int n ) : to find out the minimum value using Ternary Operator & display the result. void compute ( double a , double b) : to display the absolute difference of two real nos. void compute ( char x , char y ) : to calculate the ASCII difference of the two characters & display the result. Write a main ( ) method to accept two intege

Answers

Answered by rasmikrishnan123
7

class compute

{

void compute(int m, int n)

{

int min;

min=(m<n)? m:n;

Sytem.out.println(min);

}

void compute(double a, double b)

{

System.out.println(Math.abs(x)-Math.abs(y));

}

void compute(char x, char y)

{

System.out.println((int) x- (int) y);

}

public static void main(String args[])

{

compute ob= new compute()

//do the declaration of the variable and accept the value

ob.compute(m, n);

ob.compute(a, b);

ob.compute(x, y);

}

}

Similar questions