Wednesday, May 4, 2022

electricity bill generation code

 #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:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts