Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 2 - A car manufacturer is designing a safety program that reads in the temperature and operates a green light and a warning sound
Q 2 -
A car manufacturer is designing a safety program that reads in the temperature and operates a green light and a warning sound accordingly. This program should act as follows:
- If the temperature is between 34 and 40, it turns on the green light, and the warning sound is not turned on.
- If the temperature is below 34, it turns on the warning sound, and the green light is not turned on.
Develop an algorithm that reads in the temperature from the user, and acts accordingly.
Hints:
- Think about what data types should you use to represent the green light and the warning sound? How should they be initialized?
- Write down the decision structure that will turn on the green light and the warning sound according to the given description. Make sure that the green light and the warning sound are never on at the same time! That is, whenever you turn either of them on, you should turn off the other one.
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