Question: 1.1 Write a Java program which stores a pair of values and support following methods: getFirst, getSecond, setFirst and setSecond. (100 points) 1. Define
1.1 Write a Java program which stores a pair of values and support following methods: getFirst, getSecond, setFirst and setSecond. (100 points) 1. Define a Pair class that has: Two elements (first, second), A constructor and Four 2. methods(getFirst, getSecond, setFirst and setSecond). Implement test class TestPair that Define an array(length is 10) of Pair type. Type of first - int, type of second - double. Set the value of array.first: (0, 1, 2, ..., 8, 9). Set the value of array.second: (9.0, 8,0, ..., 1.0, 0.0). Print out the array. 1.2 Please Modify the homework1.1 by using Java Generics. (Declare two elements by using formal type parameters). (Extra 50 points)
Step by Step Solution
There are 3 Steps involved in it
a java program which stores a pair of values and supports the following methods getFirst getSecond setFirst setSecond Here is the solution java public ... View full answer
Get step-by-step solutions from verified subject matter experts
