class Electricity
{
public:
double Bill(double unit)
{
double tc;
if (unit < 100)
tc = unit * 0.5;
if (unit > 300)
tc = unit * 0.6;
double surchase = 0;
if (tc > 250)
surchase = tc * 0.15;
double total_cost;
total_cost = 250 + surchase + tc;
return total_cost;
}
};
class MoreElectricity : public Electricity
{
public:
double Bill(double unit, double add)
{
Electricity b;
double price = b.Bill(unit);
double total_cost = price + add;
return total_cost;
}
};
Comments
Leave a comment