Question: I need help with both of these methods / * * * finds all itineraries within a given price and within a given number of

I need help with both of these methods
/**
* finds all itineraries within a given price and within a given number of stops from source to destination airports
* @param ag the AirlineGraph graph representing the airline system
* @param source the String source airport code
* @param destination the String destination airport code
* @param budget the double maximum price in dollars
* @param stops the int (>=0) maximum number of stops
* @return a (possibly empty) Set> of paths with a total cost
* less than or equal to the budget and at most the given number of stops. Each path is an ArrayList of
* at most 2+stops entries starting with source and ending with destination.
*/
public Set> allTrips(AirlineGraph ag, String source, String destination, double budget, int stops);
/**
* finds all non-trivial itineraries within a given price and within a given number of stops from an airport back to itself
* @param ag the AirlineGraph graph representing the airline system
* @param source the String source airport code
* @param budget the double maximum price in dollars
* @param stops the int (>0) maximum number of stops
* @return a (possibly empty) Set> of paths with a total cost
* less than or equal to the budget and at most the given number of stops. Each path is an ArrayList of
* at least 2 and at most 2+stops entries starting and ending with source.
*/
public Set> allRoundTrips(AirlineGraph ag, String source, double budget, int stops);
}
Test Failed! Loading routes from file Finding all trips within $2697.78 and 1 stops from LTP to EFP Your solution: [] Expected solution: [[LTP ($53.78) RLY, RLY ($973.62) EFP],[LTP ($101.26) ORH, ORH ($505.48) EFP],[LTP ($723.93) NRM, NRM ($342.7) EFP]] Your solution is empty but expected solution is not.
Loading routes from file Finding all trips within $2308.82 and 2 stops from LWR Your solution: [[LWR ($441.0) PVS, PVS ($171.55) LWR],[LWR ($608.43) XUS, XUS ($757.11) LWR],[LWR ($594.46) XXS, XXS ($448.56) LWR],[LWR ($33.06) KOI, KOI ($81.65) LWR],[LWR ($38.6) FKN, FKN ($999.68) LWR]] Expected solution: [[LWR ($376.41) FEN, FEN ($156.75) PVS, PVS ($171.55) LWR],[LWR ($441.0) PVS, PVS ($171.55) LWR],[LWR ($38.6) FKN, FKN ($774.1) XXS, XXS ($448.56) LWR],[LWR ($608.43) XUS, XUS ($292.67) PVS, PVS ($171.55) LWR],[LWR ($608.43) XUS, XUS ($198.5) FKN, FKN ($999.68) LWR],[LWR ($376.41) FEN, FEN ($15.44) XXS, XXS ($448.56) LWR],[LWR ($38.6) FKN, FKN ($216.37) KOI, KOI ($81.65) LWR],[LWR ($441.0) PVS, PVS ($224.77) XUS, XUS ($757.11) LWR],[LWR ($594.46) XXS, XXS ($498.9) FKN, FKN ($999.68) LWR],[LWR ($33.06) KOI, KOI ($105.2) PVS, PVS ($171.55) LWR],[LWR ($376.41) FEN, FEN ($680.91) TUS, TUS ($879.08) LWR],[LWR ($376.41) FEN, FEN ($172.16) XUS, XUS ($757.11) LWR],[LWR ($608.43) XUS, XUS ($757.11) LWR],[LWR ($38.6) FKN, FKN ($943.66) XUS, XUS ($757.11) LWR],[LWR ($608.43) XUS, XUS ($275.52) KOI, KOI ($81.65) LWR],[LWR ($594.46) XXS, XXS ($348.09) TUS, TUS ($879.08) LWR],[LWR ($594.46) XXS, XXS ($24.02) XUS, XUS ($757.11) LWR],[LWR ($608.43) XUS, XUS ($973.81) XXS, XXS ($448.56) LWR],[LWR ($38.6) FKN, FKN ($999.68) LWR],[LWR ($608.43) XUS, XUS ($761.69) TUS, TUS ($879.08) LWR],[LWR ($38.6) FKN, FKN ($888.98) PVS, PVS ($171.55) LWR],[LWR ($594.46) XXS, XXS ($814.71) KOI, KOI ($81.65) LWR],[LWR ($441.0) PVS, PVS ($888.99) KOI, KOI ($81.65) LWR],[LWR ($33.06) KOI, KOI ($804.81) XXS, XXS ($448.56) LWR],[LWR ($441.0) PVS, PVS ($806.48) TUS, TUS ($879.08) LWR],[LWR ($441.0) PVS, PVS ($237.27) XXS, XXS ($448.56) LWR],[LWR ($376.41) FEN, FEN ($79.59) FKN, FKN ($999.68) LWR],[LWR ($33.06) KOI, KOI ($961.39) FKN, FKN ($999.68) LWR],[LWR ($594.46) XXS, XXS ($448.56) LWR],[LWR ($33.06) KOI, KOI ($671.09) TUS, TUS ($879.08) LWR],[LWR ($33.06) KOI, KOI ($81.65) LWR],[LWR ($376.41) FEN, FEN ($684.13) KOI, KOI ($81.65) LWR]] expected:[[LWR ($376.41) FEN, FEN ($156.75) PVS, PVS ($171.55) LWR],[LWR ($441.0) PVS, PVS ($171.
I need help with both of these methods / * * *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!