Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include<iostream>
#include <string>
class cityUtilities
{
/* This class will contain all the utilities in the city, e.g, water, electricity, gas and garbage. */
public:
float happiness;
int demand;
int elecSupply;
int gasSupply;
int waterSupply;
int garbageSupply;
int buildingsTotalDemand;
int buildingsTotalDemand = 0 ; /* TO BE COMPLETED- This will calculate how much demand the buildings have */
/*Electricity*/
int electricity(int demand)
{
/* This function takes in the demand of electricity and checks it against the supply */
void demandSum();
{
demand = buildingsTotalDemand + demand;
if (demand >= elecSupply + 3)
{
happiness = happiness;
}
else if (demand <= elecSupply + 4)
{
happiness = happiness * 0.95;
}
}
}
/*Gas*/
int gas(int demand)
{
/* This function takes in the demand of electricity and checks it against the supply */
void demandSum();
{
demand = buildingsTotalDemand + demand;
if (demand >= gasSupply + 3)
{
happiness = happiness;
}
else if (demand <= gasSupply + 4)
{
happiness = happiness * 0.95;
}
}
}
/*Water*/
int water(int demand)
{
/* This function takes in the demand of water and checks it against the supply */
void demandSum();
{
demand = buildingsTotalDemand + demand;
if (demand >= waterSupply + 3)
{
happiness = happiness;
}
else if (demand <= waterSupply + 4)
{
happiness = happiness * 0.95;
}
}
}
/*Garbage*/
int garbage(int demand)
{
/* This function takes in the demand of garbage and checks it against the supply */
void demandSum();
{
demand = buildingsTotalDemand + demand;
if (demand >= garbageSupply + 3)
{
happiness = happiness;
}
else if (demand <= garbageSupply + 4)
{
happiness = happiness * 0.95;
}
}
}
};