Question
could you answer as soon as possible this is java this is the contents of topo.txt FP1 -17.926 0.51499 0.10919 FPZ 0 0.50669 0.12384 FP2
could you answer as soon as possible
this is java
this is the contents of topo.txt
FP1 -17.926 0.51499 0.10919 FPZ 0 0.50669 0.12384 FP2 17.926 0.51499 0.12537 AF7 -35.892 0.52233 0.10174 AF3 -22.461 0.42113 0.083732 AF4 22.461 0.42113 0.10766 AF8 35.858 0.52231 0.13148 F7 -53.913 0.52808 0.092015 F5 -49.405 0.4316 0.07714 F3 -39.947 0.3446 0.05663 F1 -23.493 0.27903 0.047246 FZ 0 0.25338 0.060621 F2 23.493 0.27878 0.068389 F4 39.897 0.3445 0.097508 F6 49.405 0.43128 0.12917 F8 53.867 0.52807 0.12824 FT7 -71.948 0.53192 0.063585 FC5 -69.332 0.40823 0.04354 FC3 -62.425 0.28822 0.020697 FC1 -44.925 0.18118 0.013025 FCZ 0 0.12662 0.01985 FC2 44.925 0.18118 0.033945 FC4 62.425 0.28822 0.0714 FC6 69.332 0.40823 0.10099 FT8 71.948 0.53192 0.10254 T7 -90 0.53318 0.034154 C5 -90 0.3999 0.0080936 C3 -90 0.26669 0.0064161 C1 -90 0.13319 0.012379 CZ 0 0 0.021375 C2 90 0.13348 0.007836 C4 90 0.26667 0.030224 C6 90 0.3999 0.049915 T8 90 0.53318 0.071613 TP7 -108.05 0.53192 0.021104 CP5 -110.67 0.40823 0.042555 CP3 -117.58 0.28822 0.080197 CP1 -135.08 0.18118 0.12138 CPZ 180 0.12662 0.18248 CP2 135.08 0.18118 0.054668 CP4 117.58 0.28822 0.018648 CP6 110.67 0.40823 0.0075666 TP8 108.11 0.53191 0.01292 P7 -126.09 0.52808 0.1193 P5 -130.59 0.4316 0.16637 P3 -140.05 0.3446 0.20009 P1 -156.51 0.27903 0.28611 PZ 180 0.25338 0.39661 P2 156.51 0.27878 0.19522 P4 140.1 0.3445 0.09266 P6 130.59 0.43128 0.044631 P8 126.13 0.52807 0.015682 PO7 -144.11 0.52233 0.17253 PO3 -157.54 0.42113 0.20308 PO5 -149.46 0.4665 0.18358 POZ 180 0.37995 0.21287 PO4 157.54 0.42113 0.12758 PO6 149.46 0.4665 0.064723 PO8 144.14 0.52231 0.059771 O1 -162.07 0.51499 0.079895 OZ 180 0.50669 0.04594 O2 162.07 0.51499 0.042728
a)
create a class called Electrode. This class will have three variables:
type double that is public
type final that contains position(radius and angle) and amplitude at that electrode.
Then create a class called TopographyMap, this will store the data from attributes.txt, then add a private TreeMap with keys of type String and values of type Electrode.
b)Define a constructor for the Electrode class that receives the position and amplitude. Implement Comparable using the amplitude value. Furthermore implement toString so that the Electrode objects are printed as (angle, radius): amplitude like the following example: (0.5, 2): 1.34 Implement the equals() method for comparison with other Electrode objects
c)Add a constructor to the class. The constructor should receive a String as parameter that contains the name of the file. Add a method called readTopographyMap. This method should read the data from the file into the TreeMap you created in a). The key should be the label of the electrode, the value should be an Electrode object created with the coordinates and amplitude of the electrode with that label.
d)Add a private method to TopographyMap called calculate pairwise distances that returns void. This method should compute the distance between every possible pair of electrodes in your TreeMap. Store these distances in a data structure of your choice. Additionally, add a method called printDistancesLargest10 and a method called printDistancesSmallest10 that so that the former prints the largest and the latter the smallest 10 distances between electrode pairs. Now create a class called MainExercise3 with a main() method in which you create a TopographyMap object and print the smallest and largest 10 distances.
When you do this can you please explain this step by step by adding annotations if you do not mind
Step 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