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; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started