import 'dart:io'; /* Task 2: Electricity Usage Monitoring System This program monitors hourly electricity usage and provides alerts and bill discounts based on consumption. */ void main() { // 1. Set Electricity Usage Limit (in kWh) double usageLimit = 150.0; double currentTotalUsage = 0.0; print("--- Smart Home: Electricity Monitor ---"); // 2. Track Usage for 24 Hours using for loop for (int hour = 1; hour <= 24; hour++) { // Simulating random usage for each hour (e.g., between 1 to 10 kWh) double hourlyUsage = 6.5; // Example constant usage for simulation currentTotalUsage += hourlyUsage; // 3. String Concatenation & 4. Upper/Lowercase Alert if (currentTotalUsage > usageLimit) { String alertMessage = "warning: usage limit exceeded!"; print("Hour $hour: " + alertMessage.toUpperCase()); } else { print("Hour $hour: Usage is within safe limits."); } } // 5. Final Calculations print("\nTotal usage for the day: $currentTotalUsage kWh"); // 6. Discount for Conserving Energy if (currentTotalUsage < 100) { print("Congratulations! You used less than 100 kWh."); print("A 10% discount will be applied to your next bill."); } else { print("No conservation discount applied this time."); } }