We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 02
Semester: Spring 2015

CS304: Object Oriented Programming

Total Marks: 20

 

Due Date: 08/06/2015

 

Instructions:

 

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

 

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

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.

 

 

Objective:

 

The objective of this assignment is to provide hands on experience of:

 

  • Classes and objects
  • Constructors and destructors
  • Setter and Getter functions
  • Static data member
  • Member initializer list
  • Copy constructor and deep copy

 

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ guide lines while writing variable names, function names etc
  • Use only dev-C++ for this assignment.

 

 

 

For any query about the assignment, contact at cs304@vu.edu.pk

 

 

 

 ASSIGNMENT

Problem Statement:  

  

In this assignment you will be creating a class named Employee.

 

Employee class has the following data members:

  • Employee ID.
  • Employee Name
  • Department
  • Employee Salary
  • Static data member which will hold the value of total no. of employees

 

 

Employee class must have the following member functions:

 

Function

Description

Employee()

Default constructor for Employee class, which will set employee id  to 0, employee name to NULL, employee department to NULL and salary to 0.0

Employee(int, char *, char *, float);

It will take employee id, employee name, department and salary as arguments and initialize their values using member initializer list

Employee(Employee &); 

Copy constructor which will initialize one object with another object using deep copy

Setter functions

You have to define setter function for each data member which will take a value as an argument and set their values

Getter functions

You have to define getter function for each data member which will return the values of their data members

calcNetPay()

This function will calculate the net pay of an employee based on his salary

display()

This function will display the values of all data members of class

~Employee()

Destructor of Employee class which will decrement the value of static data member of class

 

 

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:

 

 

 

 

 

 

 

 

 

 

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 7348

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

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

hahaha

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)

Attachments:

good

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:

  • Classes and objects
  • Constructors and destructors
  • Setter and Getter functions
  • Static data member
  • Member initializer list
  • Copy constructor and deep copy

koi solution btay ga iska?

RSS

Latest Activity

+¢αяєℓєѕѕ gιяℓ replied to Moji's discussion Assignment #1 Semester FALL 2019 Physics (PHY101)
44 minutes ago
Asmat replied to + "J ɨ y ą ⋆'s discussion CS501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 12-11-2019 in the group CS501 Advance Computer Architecture
1 hour ago
+!!! NOOR UL JANAT !!!+ replied to Rana Ali's discussion Alfaz
1 hour ago
Rana Ali replied to Rana Ali's discussion Alfaz
2 hours ago
Rana Ali liked Rana Ali's discussion Alfaz
2 hours ago
Rana Ali liked Rana Ali's discussion Psy511 assignment no 1
2 hours ago
Rana Ali added a discussion to the group PSY511 Environmental Psychology
2 hours ago
Rana Ali liked + M.Tariq Malik's group PSY511 Environmental Psychology
2 hours ago
Rana Ali joined + M.Tariq Malik's group
2 hours ago
Rana Ali liked + M.Tariq Malik's discussion EDU302 Human Development and Learning Assignment No 01 Fall 2019 Solution & Discussion
2 hours ago
MUHAMMAD USMAN replied to MIT's discussion Operating Systems(CS604) Assignment # 01 Deadline Date 16-11-2019 in the group CS604 Operating Systems
2 hours ago
Muhammad Awais replied to Usman Mughal's discussion Assignment No. 01 Semester: Fall 2019 in the group CS101 Introduction to Computing
3 hours ago
Muhammad Awais joined + M.Tariq Malik's group
3 hours ago
Farhan Amin replied to Farhan Amin's discussion your vu email address will deleted
4 hours ago
Farhan Amin replied to Farhan Amin's discussion your vu email address will deleted
4 hours ago
+ ! ! ! ! ! AaiMa AnsaRi liked + M.Tariq Malik's discussion CS201 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 14-11-2019
5 hours ago
+ ! ! ! ! ! AaiMa AnsaRi replied to + M.Tariq Malik's discussion MGT211 GDB Fall 2019 Solution & Discussion in the group MGT211 Introduction To Business
5 hours ago
+ ! ! ! ! ! AaiMa AnsaRi joined + M.Tariq Malik's group
5 hours ago
+ ! ! ! ! ! AaiMa AnsaRi liked + M.Tariq Malik's discussion MGT211 GDB Fall 2019 Solution & Discussion
5 hours ago
+ Abb@s replied to Farhan Amin's discussion your vu email address will deleted
5 hours ago

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service