Decision making is a critical component to programming, no matter the language. Just as decisions in your day to day life can change the outcome of real life scenarios, we can use similar decision making structures to change the flow of our applications to respond to events or provide different output. The lecture provided an example of a GPS system using decision making to determine the best route to avoid traffic. That example had 2 main branches – if traffic is backed up on the express way, continue on rd, otherwise enter expressway. Consider a real-world example of where decision making can be applied to answer the following. Depending on your scenario, a program with the appropriate inputs / sensors could make these decisions and execute the actions automatically!
- Provide a brief description of the scenario.
- Explain whether the decision branches are complex or simple and how many “branches” are there.
- Describe the result or action of at least two branches