Trusted by 2+ million users,
1000+ happy students everyday
1000+ happy students everyday
Showing pages 1 to 1 of 2 pages
import java.text.NumberFormat;public class Itinerary {private Flight f1;private Flight f2;public Itinerary(Flight first) {f1 = first;f2 = null;}public Itinerary(Flight first, Flight second) {f1 = first;f2 = second;}public Flight getSecondFlight() {return f2;}public Flight getFirstFlight() {return f1;}public boolean hasConnection() {if (f2 == null) {return false;} else {return true;}}public double getTotalCost() {double total = 0;if (f2 != null) {total = f1.getCost() + f2.getCost();} else {total = f1.getCost();}return total;}public Time getDeparture() {return f1.getDeparture();}public Time getArrival() {return f2.getArrival();

You’re reading a preview
To View Complete Document
Click the button to download
Subscribe to our plans