class Calculator {
constructor(income, state) {
this.income = income
this.state = state
}
getElectricEmissions = () => {
const x = electricMultipliers.get(this.state) * this.income * (electricity / 100)
return {category: "electricity", emissions: x}
}
getFuelEmissions = () => {
return Object.keys(userFuel).map(key => {
const dollarsSpent = this.income * (userFuel[key] / 100)
const f = directMultipliers[key]
const emissions = (f.supplyChain * dollarsSpent) + (f.value * dollarsSpent)
return {category: key, emissions: emissions}
})
}
getTotalGoodsEmissions = () => Object.keys(form)
.map(key => ( {category: key, emissions: (form[key] / 100) * this.income * this.getMultiplier(key) } ) )
getMultiplier(key) {
return goodsMultipliers.has(key) ? goodsMultipliers.get(key) : 0
}
}