Assignment No. 02
CS304: Object Oriented Programming
Total Marks: 20
Due Date: 08/06/2015
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Microsoft Word Document) or .txt files or .exe file, no reward will be given in any case.
The objective of this assignment is to provide hands on experience of:
For any query about the assignment, contact at firstname.lastname@example.org
In this assignment you will be creating a class named Employee.
Employee class has the following data members:
Employee class must have the following member functions:
calcNetPay(): This function will calculate net pay of an employee based on his salary as:
If salary is less than and equal to 10,000 then tax is 0.
If salary is greater than 10,000 and less than equal to 20,000 then tax is 5%.
If salary is greater than 20,000 and less than equal to 30,000 then tax is 7%.
The tax on the salary greater than 30,000 is 10%.
Note: On creation of each object, the value of static data member should be incremented.
Within main() function, create an array of 5 objects of class Employee. Second object should be initialized with the first object.
Now, use for loop to call calcNetPay() and display() functions for each object.
You can create objects as follow:
Employee emp1(5, "Ahmad", "Accounts", 20000 );
Employee emp2(emp1) ;
Employee emp3(10, "Ayesha", "Accounts", 25000);
Employee emp4(3, "Hassan", "Administration", 10000);
Employee emp5(6, "Arsalan", "Administration", 35000);
Sample output of the program:
Please Discuss here about this assignment.Thanks
Our main purpose here discussion not just Solution
We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.
AoA Tariq bahi plz tel ky tax ki calc kesy karen gy
Error free code of Zeshan's file
I just remove some error and make some comments in code.
I think no need for my code. this is enough.
Good Work Zeshan (y)
This code is Perfect .... but some confusing
share ur confusion i'll clear it...
how can we add code in array of 5 objects.....
This section is still waiting for it's first presentation (basic coding)
Kuch karo yaroo ....
Read the following topics in lecture handouts:
koi solution btay ga iska?