Untitled
//cout //create variables //create calculation #include <iostream> using namespace std; int main(){ //variables for input float devicePowerUsage; //Power usage in watts float usageHours; //Hours the device is used in daily float carbonEmissionRate; //Carbon emission rate per kWh in kg //collecting user input cout<< "Welcome to the Green IT Calculator"<<endl; cout<< "This program calculates your total energy and carbon emissions."<<endl; cout<< "Enter the power usage of your device (in watts): "; cin>> devicePowerUsage; cout<< "Enter the number of hours the device is used daily: "; cin>> usageHours; cout<< "Enter the carbon emission rate per kWh (in kg):"; cin>> carbonEmissionRate; //Processing input float dailyEnergyUsage = (devicePowerUsage / 1000) * usageHours; //kWh float yearlyEnergyUsage = dailyEnergyUsage * 365; //kWh float yearlyCarbonEmission = yearlyEnergyUsage * carbonEmissionRate //Carbon in kg //Output results ;cout<< "\n=== Green IT Rport Individual ==="<<endl; cout<< "Daily energy usage: " <<dailyEnergyUsage<< "kWh"<< endl; cout<< "Yearly energy usage: " <<yearlyEnergyUsage<< "kWh" << endl; cout<< "Yearly carbon emissions: " <<yearlyCarbonEmission << "in kg" <<endl; //Tips for saving energy and reducing carbon footpirnt reduced cout<< "\nTips for saving energy and reducing carbon footprint!:" <<endl; cout<< "- Optimize device usage." <<endl; cout<< "- Switch to renewable energy resources if possible such as using solar for electricity." <<endl; cout<< "- Use energy-efficient devices." <<endl; return 0; }
Leave a Comment