2.2 Combination Implement a class, called Combination, to store four integer values (ints). 1. Declare the necessary instance variables to store the four integer values 2. Create a constructor, public...


2.2<br>Combination<br>Implement a class, called Combination, to store four integer values (ints).<br>1. Declare the necessary instance variables to store the four integer values<br>2. Create a constructor, public Combination(int first, int second, int third,<br>int fourth), to initialize the values of this object<br>3. Implement the instance method public boolean equals(Combination other),<br>such that equals return true if other contains the same values, in the same<br>order, as this Combination; the order is defined by the order of the pa-<br>rameters of the constructor, given the following:<br>Combination ci;<br>cl - new Combination( 1, 2, 3, 4 );<br>Combination c2;<br>c2 = new Combination( 1, 2, 3, 4 );<br>Combination c3;<br>c3 = new Combination( 4, 3, 2, 1 );<br>then c1.equals(c2) is true but c1.equals(c3) is false;<br>4. Finally, implement the method public String toString(), to return a String<br>representation of this object, where the first, second, third and fourth<br>values are concatenated and separated by : symbols. E.g.<br>Combination c%;<br>ci = new Combination( 1, 2, 3, 4 );<br>System.out.println( c1 );<br>

Extracted text: 2.2 Combination Implement a class, called Combination, to store four integer values (ints). 1. Declare the necessary instance variables to store the four integer values 2. Create a constructor, public Combination(int first, int second, int third, int fourth), to initialize the values of this object 3. Implement the instance method public boolean equals(Combination other), such that equals return true if other contains the same values, in the same order, as this Combination; the order is defined by the order of the pa- rameters of the constructor, given the following: Combination ci; cl - new Combination( 1, 2, 3, 4 ); Combination c2; c2 = new Combination( 1, 2, 3, 4 ); Combination c3; c3 = new Combination( 4, 3, 2, 1 ); then c1.equals(c2) is true but c1.equals(c3) is false; 4. Finally, implement the method public String toString(), to return a String representation of this object, where the first, second, third and fourth values are concatenated and separated by : symbols. E.g. Combination c%; ci = new Combination( 1, 2, 3, 4 ); System.out.println( c1 );

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here