Java program for the above approach
import java . util . * ; class GFG { static class pair { float first , second ; pair ( float first , float second ) { this . first = first ; this . second = second ; } }