Académique Documents
Professionnel Documents
Culture Documents
Instructions
Task 1:
Write a C++ program to calculate electricity bill of a person. Your program should ask the user
to enter units of electricity consumed this month and meter type (c for commercial and p for
personal), the program should then calculate and display the total bill in rupees the customer
needs to pay using the following bill calculation rules.
For first 100 units the rate is 5 Rs. /unit, for units 101 to 300 the rate applied would be 8 Rs.
/unit and 10 Rs. /unit rate should be applied for units 300. E.g. if units are 450 three different
rates would be applied Rs. 5 for first 100 units Rs. 8 for next 200 units and Rs. 10 for remaining
150 units.
If the meter type is commercial then 3.5% tax should be also be added in the calculated bill.
Sample Program Run-1:
Enter units consumed: 450
Enter meter type: C
National University
OF COMPUTER AND EMERGING SCIENCES CHINIOT-FAISLABAD CAMPUS
Bill Breakup:
1-100 Units
= 500 Rs.
= 500 Rs.
Task-2:
Write a C++ program that will always take 5 digit number as input and will check that it is
palindrome or not. e.g. 12321, 76867 are palindrome numbers because first digit match with
last and 2nd with 2nd last.
Sample Program Run 1:
Enter the number: 12321
Output: It is a palindrome number
Sample Program Run 2:
Enter the number: 12325
Output: It is not palindrome number
National University
OF COMPUTER AND EMERGING SCIENCES CHINIOT-FAISLABAD CAMPUS
Task-3:
Write a C++ program to input and calculate the salary of employee. There are two types of
employees one is hourly and other is monthly. Your program should ask the user to enter what
type of employees salary he/she wants to calculate where h represents hourly employee and
m represents monthly employee. If user wants to calculate hourly employees salary, you will
take following inputs Rate/hours, No of hours worked and bonus. If user wants to calculate the
salary of monthly employee, you will take following inputs Salary/month and bonus. Below are
two sample program runs one for monthly employee and one for hourly.
Sample Run 1:
Enter employee id: 12
Enter type of employee: h
Enter Rate/Hour: 25.28
Enter No of hours worked: 45
Enter Bonus: 455.32
Your salary is: 1592.92 Rs.
Sample Run 2:
Enter employee id: 195
Enter type of employee: m
Enter Salary/Month: 22000
Enter Bonus: 2350.30
Your salary is: 24350.30 Rs.