logo

Flight Itinerary Representation

   

Added on  2019-09-19

2 Pages229 Words139 Views
 | 
 | 
 | 
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();
Flight Itinerary Representation_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents