Logical variables: On Time or Delayed? Complete the function Whatlsit such that: The output logical variable on Time is true only if no Traffic is true and gasEmpty is false. The output logical variable delayed is false only if no Traffic is true and gasEmpty is false. Restriction: Logical expressions must be used. Do not use if statements. Function > 1 function [onTime, delayed] = WhatIsIt (noTraffic, gasEmpty) onTime noTraffic || (~gas Empty) 2 3 delayed (noTraffic) && (~gasEmpty) 4 end 5 Code to call your function > 1 noTraffic=true; gasEmpty = true; 2 [onTime, delayed] =WhatIs It (noTraffic, gas Empty) Save C Reset MATLAB Documentation C Reset

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is a practice problem from my Introduction to Electrical Engineering course. What I tried didn't work, as you can see. I'm hoping there may be a better suggestion to try. Thank you.

Logical variables: On Time or Delayed?
Complete the function WhatlsIt such that:
The output logical variable on Time is true only if no Traffic is true and gasEmpty is false.
The output logical variable delayed is false only if noTraffic is true and gasEmpty is false.
Restriction: Logical expressions must be used. Do not use if statements.
Function >
WhatIs It (noTraffic, gasEmpty)
onTime = noTraffic || (~gasEmpty)
delayed = (noTraffic) && (~gasEmpty)
1 function [onTime, delayed]
2
3
4 end
5
=
Code to call your function ?
1 noTraffic=true; gasEmpty
= true;
2 [onTime, delayed] =WhatIs It (noTraffic, gasEmpty)
Assessment: 1 of 5 Tests Passed (50%)
> Test outcome for no Traffic=true; gasEmpty = true;
Variable on Time has an incorrect value.
Test outcome for no Traffic=false; gasEmpty = true;
Variable delayed has an incorrect value.
Test outcome for no Traffic=false; gasEmpty = false;
Variable onTime has an incorrect value.
Test outcome for no Traffic=true; gasEmpty = true;
Variable onTime has an incorrect value.
Check that if statements are not used
Save
C Reset
MATLAB Documentation
C Reset
Run Function
Submit
0% (13%)
0% (13%)
0% (12%)
0% (12%)
50% (50%)
Total: 50%
Transcribed Image Text:Logical variables: On Time or Delayed? Complete the function WhatlsIt such that: The output logical variable on Time is true only if no Traffic is true and gasEmpty is false. The output logical variable delayed is false only if noTraffic is true and gasEmpty is false. Restriction: Logical expressions must be used. Do not use if statements. Function > WhatIs It (noTraffic, gasEmpty) onTime = noTraffic || (~gasEmpty) delayed = (noTraffic) && (~gasEmpty) 1 function [onTime, delayed] 2 3 4 end 5 = Code to call your function ? 1 noTraffic=true; gasEmpty = true; 2 [onTime, delayed] =WhatIs It (noTraffic, gasEmpty) Assessment: 1 of 5 Tests Passed (50%) > Test outcome for no Traffic=true; gasEmpty = true; Variable on Time has an incorrect value. Test outcome for no Traffic=false; gasEmpty = true; Variable delayed has an incorrect value. Test outcome for no Traffic=false; gasEmpty = false; Variable onTime has an incorrect value. Test outcome for no Traffic=true; gasEmpty = true; Variable onTime has an incorrect value. Check that if statements are not used Save C Reset MATLAB Documentation C Reset Run Function Submit 0% (13%) 0% (13%) 0% (12%) 0% (12%) 50% (50%) Total: 50%
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education