Respuesta :
Answer:
"""""""""""""""""""""""""In case of any doubt please comment""""""""""""""""""""""""
Now we need the function to return true if noTraffic= true and gasEmpty = false;
NOTE:"Rest in all cases it should return false;
Now for that to happen we use and- operator (x & y) it returns true only when both x and y are true.
but we need true when gasEmpty = false. For that we will use not function on gasEmpty.
Now the function will return true (1) only when noTraffic = true and gasEmpty = false. Rest in all case it will return false (0)
function onTime = RunningLate (noTraffic, gasEmpty)
onTime = ( (noTraffic) & not(gasEmpty) )
end
The program was written in MATLAB. The program source file has an incomplete function, that needs to be completed.
Complete the function with the following code segment
function onTime = RunningLate (noTraffic, gasEmpty)
onTime = ((noTraffic) & not(gasEmpty))
end
The following, should be noted about the above code segment
- The first line declares/defines the function; The function name is RunningLate, and it receives noTraffic and gasEmpty as its parameters
- On the second line; If noTraffic is true and gasEmpty is false, the function will return true
- If otherwise, it will return false.
I've added the image of the complete question (in a more presentable format), as an attachment.
As stated above;
After running the complete program; onTime will be true if noTraffic and gasEmpty are true and false, respectively.
Read more about MATLAB programs at;
https://brainly.com/question/7247701
