Get total distance of the train journey - Java Quiz Question


Write a program to get the total distance of the train journey.

Input (List) Output (double)
[[Chennai-null-18:00-0], [Gudur-20:00-20:20-100], [Nellore-21:00-21:10-25], [Kavali-21:30-21:35-20], [Ongole-22:30-22:40-40], [Guntur-23:30-23:35-31], [Vijayawada-01:05-01:35-45], [Hyderabad-03:20-03:50-100], [Warangal-04:45-04:50-28], [Karimnagar-06:35-null-45]] 434
[[Hyderabad-null-08:00-0], [Bhongir-08:59-09:00-47], [Aler-09:19-09:20-70], [Jangaon-09:29-09:30-84], [Ghanpur-09:53-09:54-112], [Kazipet Jn-10:28-10:30-132], [Jamikunta-10:58-10:59-168], [Odela-11:24-11:25-188], [Peddapalli-11:34-11:35-208], [Ramgundam-11:42-11:43-225], [Mancheral-11:55-11:56-239], [Belampalli-12:21-12:22-258], [Sirpur Kagazngr-01:45-null-297]] 2028
[[Nellore-null-10:00-0], [Ongole-11:30-11:40-30], [Guntur-12:30-12:50-28], [Vijayawada-14:05-14:40-35], [Kakinada-15:20-15:25-15], [Rajahmundry-16:00-16:05-18], [Visakhapatnam-17:35-null-45]] 171
[[Kavali-null-06:10-0], [Tettu-06:20-06:25-2], [Ulavapadu-06:50-06:55-10], [Singarayakonda-07:15-07:20-5], [Ongole-08:00-null-15]] 32


import java.util.*;
class GetTotalDistanceOfTrainJourney
{
    public static void main(String s[])
    {
        ArrayList<Destination> journey = new ArrayList<Destination>();
        journey.add(new Destination("Chennai", null, "18:00", 0));
        journey.add(new Destination("Gudur", "20:00", "20:20", 100));
        journey.add(new Destination("Nellore", "21:00", "21:10", 25));
        journey.add(new Destination("Kavali", "21:30", "21:35", 20));
        journey.add(new Destination("Ongole", "22:30", "22:40", 40));
        journey.add(new Destination("Guntur", "23:30", "23:35", 31));
        journey.add(new Destination("Vijayawada", "01:05", "01:35", 45));
        journey.add(new Destination("Hyderabad", "03:20", "03:50", 100));
        journey.add(new Destination("Karimnagar", "05:35", null, 60));
        System.out.println("The total distance of the whole journey is : " + getTotalDistance(journey));

    }


    private static int getTotalDistance(ArrayList<Destination> journey) {
    }

}
class Destination {

String cityName;
String arrivalTime;
String depatureTime;
int kiloMeters;

public Destination(String cityName, String arrivalTime, String depatureTime, Integer kiloMeters) {
this.cityName = cityName;
this.arrivalTime = arrivalTime;
this.depatureTime = depatureTime;
this.kiloMeters = kiloMeters;
}

@Override
public String toString() {
return "[" + cityName + "-" + arrivalTime + "-" + depatureTime + "-" + kiloMeters + "]";
}
}