please code this in java 8
2. Trains Task The Red Line train is undergoing maintenance causing delays and only has trains running in one direction. The Transit Authority needs to know how many people will be late to work as a result of these changes. You need to give them the total number of people that will be late to work on a given day based on the data they give you. Resident surveys have given us data on people's commutes. Info Passenger Info: - Passengers will enter the first train that has capacity that arrives at their station while they are there. - If two passengers arrive at a station at the same time, the passenger listed first will board the train first. - Each passenger will arrive at a specific station (arrivalstations) at a specific time (arrivalTimes). Stations are numbered 1 through any unlimited positive integer. - Each passenger will have a destination station (deststations) at which they need to get to before a specific time (destTimes) in order to be on time for work. - This data will be given in 4 list parameters where the index of each list corresponds to the same passenger. Passenger n arrives at station arrivalstations [n] at time arrivalTimes [n] Train info: - Trains can hold up to 5 people at a time. Train Info: - Trains can hold up to 5 people at a time. - Trains arrive at station 1 every 15 minutes starting at 6:30am - Trains wait for 2 minute at each station before departing, even if there are no passenger to load or unload - The amount of time it takes for a given train to travel from one station to the next will be given by the parameter timeBtwStations. Input - arrivalstations: List of integers. The nth integer in the list corresponds to the station to which the nth passerfger arrives at their station to wait for their train - arrivalTimes: List of integers. The nth integer in the list corresponds to the time at which the nth passenger arrives at their station to wait for their train - destStations: List of integers. The nth integer in the list corresponds to the station which the nth passenger will depart their train - destTimes: List of integers. The nth integer in the list corresponds to the time at which the nth passenger must arrive at their destination station. If the passenger arrives at their destination after their dest_time, they will be late for work - timeBtwStations: Integer: the time in minutes that it takes for a train to travel from one station to the next. Constraints - All inputs will be sorted, first by station, then by arrival time, in ascending order. - The destination station for any passenger will always be strictly greater than the arrival station - Times will be represented as an integer hhmm, where hh is the hour, and mm is the minutes. A method addMinutes has been provided to help add times together. Output - Return the number of passengers who were late for work Example - arrivalstations =[1,1,1,2] - arrivalTimes =[620,620,620,650] - destStations =[2,2,3,3] - destTimes =[700,700,645,655] - timeBtwStations =5 Timeline: - Time=620: Passengers 1, 2, 3 arrive at station 1 - Time=630: Train 1 arrives at Station 1 and picks up the 2 passengers waiting there. - Time=637: Train 1 arrives at Station 2 and drops off Passengers 1 and 2. - Time=644: Train 1 arrives at Station 3 and drops off Passenger 3. Train 1 continues with no more passengers to pick up - Time=645: Train 2 arrives at Station 1 and departs - Time=650: Passenger 4 arrives at Station 2 - Time=652: Train 2 arrives at Station 2 and picks up Passenger 4 - Time=659: Train 2 arrives at Station 3, drops off Passenger 4 , and departs. Passenger 4 is late. There was 1 late passenger (passenger 4 ), return 1 . import java.io.*; class Result f public static int addMinutes(int currentTime, int minutesPassed) \{ int mins = currentTime %100; int hour = currentTime /100; int totalMinutes = mins +60 hour totalMinutes += minutesPassed; int newMinutes = totalMinutes %60; int newhour = totalMinutes / 60 ; return newhour 100+ newMinutes; \} /* - Complete the 'trainschedule' function below. * The function is expected to return an INTEGER. - The function accepts following parameters: - 1. INTEGER_ARRAY arrivalstations. - 2. INTEGER_ARRAY arrivalTimes - 3. INTEGER_ARRAY deststations - 4. INTEGER_ARRAY destTimes - 5. INTEGER timeBtwStations public static int trainschedule(Listsintegers arrivalstations, Wistintegerz arrivaltimes. Wistsinteger destStations, Listcinteger destTimes. int timeBtwstations). ( y L.anguage fava:8