Question: Can anyone help me pass the TestProgam.java exercise? City.java X i public class City { private String name; private int x; private int y; private

Can anyone help me pass the TestProgam.java exercise?

Can anyone help me pass the TestProgam.java exercise? City.java X i publicclass City { private String name; private int x; private int y;

private CityMarker marker; public City (String name, int x, int y) {

City.java X i public class City { private String name; private int x; private int y; private CityMarker marker; public City (String name, int x, int y) { this.name = name; this.x = x; this.y = y; } 13 public String getName() { return name; } } 2 3 4 5 6 7 80 9 10 11 12 13 140 15 16 17 180 19 20 21 220 23 24 25 260 27 28 29 300 31 32 } public int getX() { return x; } public int gety () { return y; } "Program.java CompressedArray.java X TestProgram.java *TestCompressed Array.java CityMarker.java 1 import java.util.Arrays; 2 public class CompressedArray ( 3 private int origArraySize; 4 private double array[]; 5 60 public CompressedArray (double[][] aArray) { 7 int n = aArray.length; int total = (n * (n - 1)) / 2; 9 int i, j, k = 0; 10 origArraySize = total; 11 array = new double[total]; 12 for (i = 0; i ) 16 array(k++] = aArray[i][i]; 17 18 19 } 20 210 public int getLength () { 22 return origArraySize; 23 } 24 250 public double getElement(int i) { 26 return array[i]; 27 } 28 290 @Override A 30 public boolean equals(object obj) { 31 if (this == obj) { 32 return true; } 34 if (obj == null) { 35 return false; 36 } 37 if (getClass() != obj.getClass()) { 38 return false; 39 } 40 final CompressedArray other = (CompressedArray) obj; 41 if (this.origArraySize != other.origArraySize ) { 42 return false; 43 } 44 if (!Arrays.equals(this.array, other.array)) { 45 return false; 46 } 47 return true; 48 } 49 500 @Override 51 public String toString() { 52 String t = ""; 53 for (int i = 0; i ) 16 array(k++] = aArray[i][i]; 17 18 19 } 20 210 public int getLength () { 22 return origArraySize; 23 } 24 250 public double getElement(int i) { 26 return array[i]; 27 } 28 290 @Override A 30 public boolean equals(object obj) { 31 if (this == obj) { 32 return true; } 34 if (obj == null) { 35 return false; 36 } 37 if (getClass() != obj.getClass()) { 38 return false; 39 } 40 final CompressedArray other = (CompressedArray) obj; 41 if (this.origArraySize != other.origArraySize ) { 42 return false; 43 } 44 if (!Arrays.equals(this.array, other.array)) { 45 return false; 46 } 47 return true; 48 } 49 500 @Override 51 public String toString() { 52 String t = ""; 53 for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!