import java.text.NumberFormat;.

Added on -2019-09-19

| 2 pages
| 229 words

Trusted by 2+ million users,
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();

Found this document preview useful?

You are reading a preview
Upload your documents to download
Become a Desklib member to get accesss

Students who viewed this