Lab 1: ADT Pair solution

$19.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Introduction
An ordered pair is a simple abstract data type often use in various applications. A pair consists
of two objects x and y. These two objects do not have to be the same type. For example, we can
have a pair of string and integer, a pair of floating-point number and string, etc. Generally, a pair
of object x and y is represented by (x,y). Note that x or y can also be a pair (e.g., (x,(y,z))).
The object x is called the first element and the object y is called the second element. Two pairs
(x,y) and (a,b) are said to be equal if and only if x is equal to a and y is equal to b. The order of
a pair can be reversed by simply swap the first and the second elements. For example, the reverse
order of the pair (x,y) is the pair (y,x). The behavior of the ADT pair can be represented as a
Java interface named PairInterface as shown below:
public interface PairInterface