Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assignment No. 3 Semester: Fall 2010 CS201: Introduction to Programming solution
#1
Problem Statement: Calculate salary

You are required to write a program which will calculate the salary of an employee according to his/her grade assigned by the employer. You must declare a class named CalSalary whose private data members will be employee ID, employee name and employee grade. Also write a constructor, setter and getter functions for all private data members and a function that will calculate the salary.

Detailed Description:
• Employee ID and grade should be of type integer. Employee name should be of type string.
• Constructor should initialize employee ID and grade with value zero and employee name with value NULL.
• For assigning or extracting values from private data members, you must use getter and setter functions.
• Declare a public member function named calculate which will calculate the net salary of the employee according to his/her grade.
• Formula for calculating actual salary is (Basic Salary) + 45% of basic salary.
• If the grade of employee is 17, then the basic salary is 15,000.
• If the grade is 18, then the basic salary is 20,000 and if grade is 19 then the basic salary is 25,000.

Sample Output 1

Please enter employee ID : 001
Please enter employee name : Mohammad Ali
Please enter employee grade : 17

The net salary of Mohammad Ali is Rs.21750



Sample Output 2

Please enter employee ID : 2
Please enter employee name : Aslam Khan
Please enter employee grade : 19

The net salary of Aslam Khan is Rs.36250


Attached Files
.doc   Fall 2010_CS201_3.doc (Size: 162.5 KB / Downloads: 570)
Reply
#2
[SIZE="7"]Solution[/SIZE]
Code:
#include<iostream.h> #include<conio.h> #include<string.h> using namespace std; class CalSalary {private: int EID, EGrade; string Name; public: CalSalary() {EID=0; EGrade=0; Name='/0';} void GetInput() {cout<<"please enter employee name : "; cin>>Name; cout<<"please enter employee ID : "; cin>>EID; cout<<"please enter employee Grade : "; cin>>EGrade;} int GetID() {return EID;} void SetID(int ID) {EID=ID;} int GetGrade() {return EGrade;} void SetGrade(int Grade) {EID=Grade;} string GetName() {return Name;} void SetName(string N) {Name=N;} void Calculate(int G) {switch(G) {case 17: {cout<<endl<<"The Net salary of "<<Name<<" Is Rs."<<21750<<endl; break;} case 18: {cout<<endl<<"The Net salary of "<<Name<<" Is Rs."<<29000<<endl; break;} case 19: {cout<<endl<<"The Net salary of "<<Name<<" Is Rs."<<36250<<endl; break;} default : cout<<"Grade of Employee is incorrect"<<endl; } } }; main() { int G=0; CalSalary cal; cal.GetInput(); G=cal.GetGrade(); cal.Calculate(G); getch(); }
Reply
#3
Will upload soon. Don't worry
Reply
#4
Have some body sovled the assignment No. 3 CS201 of Jan-06-2011
Reply
#5
dear working on it. will be uploaded soon. dont u worry.
Reply
#6
please up load the solution tomorrow is the last day
Reply
#7
yah wait it will be uploaded
Reply
#8
also upload the solution of CS301 assignment 3. today is last date.. pllzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Reply
#9
cs301 solution has been uploaded dear. why don't you search the forum.
Reply
#10
all of u cant make ur assignments then how will u be able to code ur practical life programmes
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS301 Assignment # 4 Due Date: 02-Feb-2016 Vuhelper 0 2,322 02-03-2016, 05:38 PM
Last Post: Vuhelper
  CS703 – Advanced Operating Systems Assignment No.3 solution January 2016 Vuhelper 0 5,909 01-23-2016, 09:58 PM
Last Post: Vuhelper
  CS601 Data Communication Assignment No. 03 Solution 23rd January 2016 Vuhelper 1 1,928 01-23-2016, 06:09 PM
Last Post: Vuhelper
  CS403 Assignment No. 03 Solution 23rd January 2016 Vuhelper 2 1,165 01-23-2016, 03:18 PM
Last Post: Vuhelper
  CS506 Web Design and Development Assignment no 3 Solution 3rd January 2016 Vuhelper 0 2,242 01-23-2016, 03:16 PM
Last Post: Vuhelper
  CS724 Software Process Improvement Assignment No 01 Solution 20th January 2016 Vuhelper 0 1,967 01-20-2016, 06:26 PM
Last Post: Vuhelper
  CS711 Software Design Assignment No 01 Solution Due Date Feb 12, 2016 Vuhelper 0 1,664 01-20-2016, 06:24 PM
Last Post: Vuhelper
  CS709 Formal Methods for Software Engineering Assignment No 01 Solution January 2016 Vuhelper 0 1,801 01-20-2016, 06:22 PM
Last Post: Vuhelper
  cs703 assignment no 3 Solution 20th January 2016 Vuhelper 0 1,701 01-20-2016, 06:20 PM
Last Post: Vuhelper
  CS704 Assignment No. 01 Solution January 2016 Vuhelper 0 4,799 01-20-2016, 06:19 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)