Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve in python 3 Task The Red Line train is undergoing maintenance causing delays and only has trains running in one direction. The Transit
please solve in python 3
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 whille 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 spechic 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. - 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 timeB twS tations. Input arrivats tations: List of integers. The nth integer in the list corresponds to the station to which the nth passenger 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 - arrivatstations: Lst of integers. The nth integer in the list corresponds to the station to which the nth passenger 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 - dest Times: List of integers. The nth integer in the list corresponds to the time at which the nth passenger must arrive at their destinatian station. - If the passenger arrives at their destination after their dest_time, they will be late for work timeB twStations: Integen 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 passenggr will always be strictly greater than the arrival station - Times will be represented as an integer hhmm, where hh is the hour, and nm 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 -arrivatstations=[1,1,1,2}-orrivalTimes=[620,620,620,650}-deststations=[2,2,3,3]-destTimes=[700,700,645,655}-trimeBtwStations=5 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started