0% found this document useful (0 votes)
28 views

GHG Calculator

This C++ program calculates greenhouse gas (GHG) emission cuts for various sectors in Kampala City to work towards a 15% overall reduction target. It prompts the user to input percentage cuts for industry, deforestation, power/energy, agriculture, transportation, waste, water management, and buildings. It then calculates the total cut and provides feedback on whether the target was reached, exceeded, or not met so changes can be identified.

Uploaded by

Majier Makeer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

GHG Calculator

This C++ program calculates greenhouse gas (GHG) emission cuts for various sectors in Kampala City to work towards a 15% overall reduction target. It prompts the user to input percentage cuts for industry, deforestation, power/energy, agriculture, transportation, waste, water management, and buildings. It then calculates the total cut and provides feedback on whether the target was reached, exceeded, or not met so changes can be identified.

Uploaded by

Majier Makeer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

/*Program to calculate, test, simulate and reports where changes need to be made

for a better City */

#include <iostream>

#include <stdlib.h>

using namespace std;

int main()
{
//Declaring Variables
int
Industry=19,Deforestation=17,PowerEnergy=15,Agriculture=14,Transport=10,Waste=10,Wa
terManagement=10,Buildings=5;
int input=0,inputlimit=1;
double cut,IN,DE,PE,AG,TR,WA,WM,BU;
bool outofinputs = false;

//Prompt the user to Enter number (percentages of each GHG)

cout<<"\n\tKAMPALA CITY COUNCIL LOW CARBON CITIES FRAMEWORK CALCULATOR.\n";

for(int i=0;i<3;i++){
cout<<"\nENTER GHG PERCENTAGE CUTS\n";
cout<<"\nEnter percentage of Industry: ";
cin>>IN;
while(IN < IN && !outofinputs){
if(input < inputlimit){
input++;
}else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!\n";
} else{
cout<<"\nEnter percentage of Deforestation: ";
cin>>DE;
}
while(Deforestation < DE && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<<"\nEnter percentage of Power & Energy: ";
cin>>PE;
}
while(PowerEnergy < PE && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<<"\nEnter percentage of Agriculture: ";
cin>>AG;
}
while(Agriculture < AG && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<<"\nEnter percentage of Transportation: ";
cin>>TR;
}
while(Transport < TR && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<<"\nEnter percentage of Waste: ";
cin>>WA;
}
while(Waste < WA && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<<"\nEnter percentage of Water Management: ";
cin>>WM;
}
while(WaterManagement < WM && !outofinputs){
if(input < inputlimit){
input++;
} else{
outofinputs = true;
}
}
if(outofinputs){
cout<<"Invalid input!";
} else{
cout<< "\nEnter percentage of Buildings: ";
cin>>BU;
}
while(Buildings < BU && !outofinputs){
if(input < inputlimit){
input++;
}else{
outofinputs = true;7;
}
}

if(outofinputs){
cout<<"Invalid input!";
}

cut = IN + DE + PE + AG + TR + WA + WM + BU;

cout<<"Percentage Cut of GHG is "<<cut<<endl;


if(cut == 15){
cout<<"Thank You!";
} else if (cut > 15){
cout<<"The Total Percentage Cut is greater than 15%\n";
} else {
cout<<"The Percentage Cut is less than the required 15%\n";
}
break;
}

return 0;
}

You might also like