Question: I need help on line 20 of Program.Java, this program is supposed to: City.Java: -This class represents each city that is loaded in from a
I need help on line 20 of Program.Java, this program is supposed to:
City.Java:
-This class represents each city that is loaded in from a text file. It is a simple class that just contains the city's name, x and y coordinates, and a CityMarker icon.
CompressedArray.Java:
- This class represents the array that has been compressed from a matrix (2D array) into a linear array that excludes elements from the diagonal and any elements above or to the right of the diagonal. Only elements below or to the left of the matrix diagonal must be included in the CompressedArray
Program.Java:
-This class, as its name suggests, will be the main heart of the program. It will be the entry point of the program, read in a file of cities and create objects for each of them, contain the array of those cities, and create a CompressedArray containing the distances between each of the cities read in from the file.
Inputs are such as:
USA
20
30


D'City.java X *Program.java public class City { Compressed Array.java X import java.util.Arrays; public class CompressedArray { private int origArraySize; private double array(); 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; } 8- 60 7 8 9 10 11 12 13 14 15 16 17 public CompressedArray (double[][] aArray) { int n = aArray.length; int total = (n + (n - 1)) / 2; int i, j, k = 0; origArraySize = total; array = new double[total]; public String getName() { return name; } for (i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
