#include <iostream>
using namespace std;
class bill
{
public:
int unit, result;
bill()
{
cout << "enter units consumed\n";
cin >> unit;
if (unit > 0 && unit <= 100)
{
cout << "bill generated is Rs. " << unit * 10 << endl;
}
if (unit <= 200)
{
result = (100 * 10) + ((unit - 100) * 15);//unit-100 is for bill above 100
cout << "bill generated is Rs. " << result << endl;
}
if (unit <= 300)
{
result = (100 * 10) + (100 * 15) + ((unit - 200) * 20);
cout << "bill generated is Rs. " << result << endl;
}
if (unit > 300)
{
result = (100 * 10) + (100 * 15) + (100 * 20) + ((unit - 300) * 25);
cout << "bill generated is Rs. " << result << endl;
}
}
};
int main()
{
bill b;
return 0;
}
No comments:
Post a Comment