Answered step by step
Verified Expert Solution
Link Copied!

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:

  1. If the temperature is between 34 and 40, it turns on the green light, and the warning sound is not turned on.
  2. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

What are the drawbacks of financial models? Of scoring models?

Answered: 1 week ago

Question

Describe the appropriate use of supplementary parts of a letter.

Answered: 1 week ago