Plzzzz solve this program correctly
Attachments:
Answers
Answered by
1
Answer:-
import java.util.*;
class Program
{
void compute(int m, int n)
{
Sysyem.out.println("Minimum Value: "+(m>n)?n:m);
}
void compute(double a, double b)
{
System.out.println("Absolute difference is: "+Math.abs(a-b));
}
void compute(char x, char y)
{
int m=x, n=y;
System.out.println("ASCII difference is: "+Math.abs(m-n));
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
Program obj=new Program();
System.out.println("Enter 2 integers...");
int a=sc.nextInt();
int b=sc.nextInt();
compute(a, b);
System.out.println("Enter 2 double values...");
double x=sc.nextInt();
double y=sc.nextInt();
compute(x, y);
System.out.println("Enter 2 characters...");
char m=sc.next().charAt(0);
char n=sc.next().charAt(0);
compute(m, n);
}
}
Similar questions