Computer Science, asked by nadinimahapatra388, 6 months ago

Please answer me these program it's urgent any genius please help me​

Attachments:

Answers

Answered by Oreki
0

import java.util.Scanner;

public class Overload {

void compute(int n, int m) {

System.out.println("Minimum value - " + ((n < m) ? n : m));

}

void compute(double a, double b) {

System.out.println("Absolute difference - " + Math.abs(a - b));

}

void compute(char x, char y) {

System.out.println("ASCII difference - " + ((int) x - (int) y));

}

public static void main(String[ ] args) {

Scanner sc = new Scanner(System.in);

Overload obj = new Overload( );

System.out.println("Enter two Integer values - ");

obj.compute(sc.nextInt( ), sc.nextInt( ));

System.out.println("Enter two Double values - ");

obj.compute(sc.nextDouble( ), sc.nextDouble( ));

System.out.println("Enter two Character values - ");

obj.compute(sc.next( ).charAt(0), sc.next( ).charAt(0));

}

}

Similar questions