IT Final Lab Solution
IT Final Lab Solution
Question # 1 Dry run the code in your mid mentioned the exact outputs within these boxes.[Q Marks-20]
Question # 2 [Q Marks-20]
Write a FUNCTION that calculates how much bill user has to pay according to the usage of
Electricity units. User will provide just number of units he consumed in main function.
Constraints:
1. Rate of the first 100 units is Rs15/unit, for 100-300 units - its Rs25/Unit and for more than
that, its Rs27/Unit.
2. You have to add Nelum-Jehlum surcharge as 15% of total bill.
3. Now add TV charges RS50 in every bill.
4. If the bill exceeds RS500, give them discount of 3% on total.
#include <iostream>
#include <conio.h>
using namespace std;
void calc_Electricity(int unit);
int main()
{
int unit;
cout << "Enter total units consumed: ";
cin >> unit;
calc_Electricity(unit);
return 0;
}
double amount;
float sur = 0.15, total = 0, bill;
int tv = 50;
}
else if (unit > 100 && unit < 300)
{
amount = 25 * unit;
bill = (sur * amount) + amount;
bill = bill + tv;
total = bill;
cout << "Electricity bill = Rs." << total;
}
else if ((unit > 300)) {
amount = 27 * unit;
bill = (sur * amount) + amount;
bill = bill + tv;
total = bill;
cout << "Electricity bill = Rs." << total;
}
else if (total > 500)
total = total *0.3;
else
cout << "your bill is" << total;
}