calculatetotaltime

CF

function calculateTotalTime

The function/method calculateTotalTime accepts an argument str. The string str contains multiple integers separated by a space,…