Question: Task 1 : Sensor Data Simulation ( Random Numbers ) [ 1 5 points ] Use the function to generate random temperature and humidity readings

Task 1: Sensor Data Simulation (Random Numbers)[15 points]
Use the
function to generate random temperature and humidity readings for three
sensors.
Each temperature should be a random floating-point value between 15.0C and 30.0C.
Each humidity reading should be a random integer between 30% and 60%.
Display the simulated sensor data.
Task 2: Data Comparison and Alerts (Comparison Operations)[15 points]
Define temperature and humidity thresholds (e.g.,28C for temperature and 50% for
humidity).
Compare each sensor's data to the thresholds.
If the temperature exceeds the threshold, display an alert that the room is too hot.
If the humidity is below the threshold, display an alert for low humidity.
Output the result of the comparison for each sensor.
Task 3: Data Processing (Math Operations)[15 points]
Calculate the average temperature across the sensors.
Convert the average temperature from Celsius to Fahrenheit using the formula:
Fahrenheit = Celsius 95+32 Fahrenheit=Celsius 59+32
Print the average temperature in both Celsius and Fahrenheit.
Task 4: Sensor Status Encoding (Bitwise Operations)[15 points]
For each sensor, encode a status using bitwise operations:
Use bit 0 to represent if the temperature is above the threshold (1 for true, 0 for false).
Use bit 1 to represent if the humidity is below the threshold (1 for true, 0 for false).
Display the binary status for each sensor (e.g.,01 means temperature is fine but humidity is
low).
Task 5: Logging Sensor Data (String Manipulation)[20 points]
Use string manipulation to log the sensor names (e.g., "Living Room", "Bedroom", "Kitchen").
Concatenate each sensor's name with its temperature and humidity readings and formatted
status.
Format the output using
and
to display aligned sensor logs.
Task 1 : Sensor Data Simulation ( Random Numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!