#include <iostream>
using namespace std;

/* This program decides on which light bulb is the better deal
Inputs:
Initial cost of bulb1
Initial cost of bulb2
Power used for bulb1
Power used for bulb2
Cost of power
Outputs:
Total cost for a year of bulb 1 usage
Total cost for a year of bulb 2 usage
Logic:
Total cost is power cost + initial cost for each bulb
Test Cases:
1)
bulb1Cost = 10.50; // dollars
bulb2Cost = 0.85;
bulb1Power = 0.005; // KW
bulb2Power = 0.100; // KW
totalBulb1 = 12.69
totalBulb2 = 44.65
2)
bulb1Cost = 0; // dollars
bulb2Cost = 0;
bulb1Power = 0.005; // KW
bulb2Power = 0.100; // KW
totalBulb1 = 2.19
totalBulb2 = 43.8
3)
bulb1Cost = 10.50; // dollars
bulb2Cost = 0.85;
bulb1Power = 0.000; // KW
bulb2Power = 0.000; // KW
totalBulb1 = 10.50
totalBulb2 = 0.85
*/
int main()
{
// Inputs
float bulb1Cost = 10.50; // dollars
float bulb2Cost = 0.85;
float bulb1Power = 0.005; // KW
float bulb2Power = 0.100; // KW

float totalCost1;
float totalCost2;

float powerCost1;
float powerCost2;

float hoursPerDay = 16; // sleep for 8 hours
float daysPerYear = 365;
float powerRate = 0.075; // 7.5 cents per kwh

powerCost1 = bulb1Power * hoursPerDay * daysPerYear * powerRate;
powerCost2 = bulb2Power * hoursPerDay * daysPerYear * powerRate;

totalCost1 = bulb1Cost + powerCost1;
totalCost2 = bulb2Cost + powerCost2;

cout << "Bulb 1 Cost " << totalCost1 << endl;
cout << "Bulb 2 Cost " << totalCost2 << endl;
// system("pause");
}
cs-142/bulb.txt · Last modified: 2016/09/06 16:38 by kseppi