This line
public static void Edge(Vertex altCity, int altPrice){
is not a constructor; it's a static method that returns void
. Constructors aren't static
and they don't return anything. Try
public Edge(Vertex altCity, int altPrice){
In addition, your Edge
class's member variables shouldn't be static
either:
public int price;
public Vertex city;