Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribedimage text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions