fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main() {
  6. const double FACTOR_RATE = 0.0097822; // PHP per watt-hour
  7.  
  8. int watts = 3950;
  9. int hoursPerDay = 6;
  10. int daysPerWeek = 7;
  11. int weeksPerMonth = 4;
  12. std::string applianceName = "A/C Floor Stand non inverter 4.5HP";
  13.  
  14. double costPerHour = watts * FACTOR_RATE; // PHP per hour
  15. double costPerDay = costPerHour * hoursPerDay; // PHP per day
  16. double costPerWeek = costPerDay * daysPerWeek; // PHP per week
  17. double costPerMonth = costPerWeek * weeksPerMonth; // PHP per month
  18.  
  19. cout << fixed << setprecision(2);
  20. cout << "Appliance: " << applianceName << endl;
  21. cout << "Wattage: " << watts << " watts" << endl;
  22. cout << "Usage: " << hoursPerDay << " hours/day for " << daysPerWeek << " days/week and " << weeksPerMonth << " weeks/month" << endl;
  23. cout << "-----------------------------" << endl;
  24. cout << "Cost per hour: PHP " << costPerHour << endl;
  25. cout << "Cost per day: PHP " << costPerDay << endl;
  26. cout << "Cost per week: PHP " << costPerWeek << endl;
  27. cout << "Cost per month: PHP " << costPerMonth << endl;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Appliance: A/C Floor Stand non inverter 4.5HP
Wattage: 3950 watts
Usage: 6 hours/day for 7 days/week and 4 weeks/month
-----------------------------
Cost per hour: PHP 38.64
Cost per day: PHP 231.84
Cost per week: PHP 1622.87
Cost per month: PHP 6491.47