I need Help PLZ ( Java Code ).
Today 14.06.2019 I have to hand in my homework.
reachability
Actually, you find flying very good, but you do not trust the whole new-fangled flying stuff and the infrastructure it has built up. As a diehard medieval metal fan you prefer to travel from A to B but rather the good old catapult. Since one can not easily take the favorite cat on vacation with it (cats do not get drafts, which is why ICEs are also eliminated), they let themselves be asked to take a plane on vacation. So you are now looking at the network spanned by airports and existing direct connections and wondering which airports are actually critical. A critical airport is an airport whose sudden disappearance would make it impossible to reach all other (remaining) airports from any (remaining) airport. For example, in the following example, the airports ICT and TXL are critical airports, but not BER:

So you decide to write a program that will calculate the amount of critical airports for you. You can assume the following assumptions:
At the beginning, all other airports can be reached from any
airport.
If a connection from airport
F1 to F2 airport will also consist of a link from F2 airport back
to F1.
In the ads.set3.airports package, write a CriticalAirportFinder
class and implement the following method:
/ **
* Finds whose removal causes unrealistic destinations. Thus,
the
* result must be a set of airports that, if removed, cause at least
one pair of
* other airports to have no path between them.
*
* @param airports set of airports.
* @return set of critical airports. Can it be empty?
* airports without a path between them in the input. Must not
be
* {@code null}.
* /
public static set findCriticalAirports (Set airports) {
// TODO Implement me!
}
/************* the airport class is ***********************/
package ads.set3.airports;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
/**
* Models an airport. For them to be identifiable, all airports have
an
* IATA code and
* two airports are considered equal if their IATA codes match.
Since this class
* implements {@link #equals(Object)} and {@link #hashCode()}, it
can be used in
* hash-based data structures, such as {@link HashSet}.
*
*
* Each airport has a (possibly empty) set of designations that can
be reached
* directly (that is, there are direct flights from this airport to
all
* designation airports). If there is a direct flight from this
airport to
* another airport, there will be a direct return flight as
well.
*
*/
public final class Airport implements Comparable {
/** The airport's IATA designation. */
private final String iataDesignation;
/** Set of airports that can be reached from this
airport. */
private final Set destinations = new
HashSet<>();
/**
* Creates a new airport with no connected
airports.
*
* @param iataCode the airport's non-{@code null} IATA
designation.
* @throw IllegalArgumentException if the code is
invalid.
*/
public Airport(String iataCode) {
ensureValidIataDesignation(iataCode);
this.iataDesignation =
iataCode;
}
/**
* Throws an {@link IllegalArgumentException} if the
given String is not a valid
* IATA designation.
*/
public static void ensureValidIataDesignation(String
iata) {
if (iata == null) {
throw new
IllegalArgumentException("IATA code cannot be null.");
}
if
(!Pattern.matches("[a-zA-Z]{3}", iata)) {
throw new
IllegalArgumentException("IATA codes must consist of three
characters.");
}
}
/**
* Returns this airport's IATA designation.
*/
public String getIataDesignation() {
return iataDesignation;
}
/**
* Returns the airport's set of destinations that can
be reached directly, to be
* modified at will.
*/
public Set getDestinations() {
return destinations;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Airport) {
return
((Airport)
obj).getIataDesignation().equals(this.getIataDesignation());
} else {
return
false;
}
}
@Override
public int hashCode() {
return
getIataDesignation().hashCode();
}
@Override
public int compareTo(Airport o) {
return
iataDesignation.compareTo(o.iataDesignation);
}
}
/**********************************************************/
/******* I tried with this code but I still ve a problem with arrive methode , doesnt give me the path between the airports*****/
/********** this verboten parameter means the airports that is removed from the set *****/
public static Set<Airport> findCriticalAirports(Set<Airport> airports) {
Set<Airport> result = new HashSet<>();
Iterator<Airport> iterator = airports.iterator();
while(iterator.hasNext()) {
Airport currentAirport = iterator.next();
// we will think that a airport forms a group of its own.
HashMap<Airport, Integer> groupParent = new HashMap<>();
ArrayList<Airport> otherAirports = new ArrayList<>(airports);
otherAirports.remove(currentAirport);
int count = 0;
for(Airport a: otherAirports) {
groupParent.put(a, count++);
}
for(Airport s: otherAirports) {
for(Airport d: s.getDestinations()) {
if(!d.equals(currentAirport)) {
int a = groupParent.get(s);
int b = groupParent.get(d);
if(a != b) {
groupParent.put(s, Math.min(a, b));
groupParent.put(d, Math.min(a, b));
}
}
}
}
if(new HashSet<>(groupParent.values()).size() > 1) {
result.add(currentAirport);
}
}
return result;
}

Please upvote, as i have given the exact answer as asked in
question. Still in case of any issues in code, let me know in
comments. Thanks!
I need Help PLZ ( Java Code ). Today 14.06.2019 I have to hand in my...
I need Help PLZ ( Java Code ).
Tomorrow 05.06.2019 I have to hand in my homework.
reachability
Actually, you find flying very good, but you do not
trust the whole new-fangled flying stuff and the infrastructure it
has built up. As a diehard medieval metal fan you prefer to travel
from A to B but rather the good old catapult. Since one can not
easily take the favorite cat on vacation with it (cats do not get
drafts, which...
I need help with my homework. The task: Actually, you find flying very good, but you do not trust the whole new-fangled flying stuff and the infrastructure it has built up. As a diehard medieval metal fan you prefer to travel from A to B but rather the good old catapult. Since one can not easily take the favorite cat on vacation with it (cats do not get drafts, which is why ICEs are also eliminated), they let themselves be...
This is my code that i need to finish. In BoxRegion.java I have no idea how to create the constructor. I tried to use super(x,y) but It is hard to apply. And Also In BoxRegionHashTable, I don't know how to create displayAnnotation BoxRegion.java ------------------------------------------------ public final class BoxRegion { final Point2D p1; final Point2D p2; /** * Create a new 3D point with given x, y and z values * * @param x1, y1 are the x,y coordinates for point...
Would someone help please, with code to finish. Iterator and entrySet, I need help. please ``` package coll.MapSet; import java.util.*; public class MapSet extends AbstractMap> implements Iterable { private Map> mapset = new HashMap<>(); /* Implement addValue such that calling this method adds the given value to the HashSet associated with the given key. This method must have the following signature: addValue(K key, V value) */ public void addValue(K key, V value) { // If the set has the key,...
I need help with my Java code. A user enters a sentence and the program will tell you what words were duplicated and how many times. If the same word is in the sentence twice, but one is capitalized, it will not count it as a duplicate. How can I make the program read the same word as the same word, even if one is capitalized and the other is not? For example, "the" and "The" should be counted as...
(Need to complete the methods and pass a Junit test i can email them to you.) public class Triangle implements Comparable { /** * Stores the number of objects instantiated from the {@code Triangle} class */ private static int numTriangles; /** * The shortest side of the triangle */ private final double a; /** * The side of medium length of the triangle */ private final double b;...
Need help with fixing "TreeMap cannot be resolved to a type" error in code. This was posted in another chegg question but has errors. Was wondering if someone can please fix this. Link to the question asked: https://www.chegg.com/homework-help/questions-and-answers/using-java-import-javautiliterator-import-javautilnosuchelementexception-public-class-pric-q44594716?trackid=undefined I have written the updated code (changes highlighted with green color). The idea is to add a new treemap to priceQueue class to be able to satisfy the asked requirements. Now, if we look at the changes we will need to update...
Hello in C#. I need help understanding and knwoing what i missed in my program. The issue is, the program is supposed to have user input for 12 family members and at the end of the 12 it asks for user to input a name to search for. When i put a correct name, it always gives me a relative not found message. WHat did i miss. And can you adjust the new code so im able to see where...
I need help with adding comments to my code and I need a uml diagram for it. PLs help.... Zipcodeproject.java package zipcodesproject; import java.util.Scanner; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Zipcodesproject { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input=new Scanner(System.in); BufferedReader reader; int code; String state,town; ziplist listOFCodes=new ziplist(); try { reader = new BufferedReader(new FileReader("C:UsersJayDesktopzipcodes.txt")); String line = reader.readLine(); while (line != null) { code=Integer.parseInt(line); line =...
I need help with the following Java code Consider a class Fraction of fractions. Each fraction is signed and has a numerator and a denominator that are integers. Your class should be able to add, subtract, multiply, and divide two fractions. These methods should have a fraction as a parameter and should return the result of the operation as a fraction. The class should also be able to find the reciprocal of a fraction, compare two fractions, decide whether two...