Assignment No. 3 Semester: Fall 2010 CS201: Introduction to Programming | Total Marks: 20 Due Date: 06 Jan, 2011 | ||
Instructions: Please read the following instructions carefully before submitting your 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. All types of plagiarism are strictly prohibited. Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted. If you will submit code any other file format like .doc or .txt etc. you will get zero marks. Objective The objective of this assignment is to provide hands on experience of using § Functions of C/C++ § Classes in C/C++ § Creating and manipulating objects. Guidelines § Code should be properly aligned and well commented. § Follow C/C++ rules while writing variables names, function names etc. § Use only Dev-C++ IDE for this assignment. | |||
Assignment | |||
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:
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 | |||
Note: you have to use same Class and Function name as mentioned in the assignment details. If we find any deviation, marks will be deducted. Deadline: Your Assignment solution must be submitted on or before January 06, 2011. | |||
-------------------------------------------------- Solution // Name: YASIR JAVAED // VU ID: MC090200982 // In this programe input take from user and calculate salary predefined Rules and it designed with class name calsalary. #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() // here takes input of emplyee name. {cout<<"please enter employee name : "; cin>>Name; // here takes input of employee ID which is numeric only. cout<<"please enter employee ID : "; cin>>EID; // here takes input of employee grade which is also numeric only. 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) // In this section define the salary amount on grade wise system. here are only 17, 18, 19 grades salary case. you should add more or less. {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; } } // here are class name Calsalary. }; main() { int G=0; CalSalary cal; cal.GetInput(); G=cal.GetGrade(); cal.Calculate(G); getch(); } |
Here All students can get Virtual University Past Old Midterm Final term Solve Papers Quiz Assignments Projects Solutions.
CS201 Assignment 3 SOLUTION
Subscribe to:
Post Comments (Atom)
-
ACTIVATION OF THE SEMESTER FREEZE LINK Published On: Tuesday, November 20, 2012 Dear students, You are informed that rules an...
-
MGT201…. Midterm Subjective Suppose ABC Company is given Rs. 3 as a dividend which is expected to grow at constant rate of 9% per year...
-
General Manager IT in City School Lahore APPLY Industry: Education/Training Functional Area: ...
-
How to set up a hotspot shield? Step 1 >> Download Hotspot shield here after download install hotspot shield into your compu...
-
MGT602= t Midterm Subjective Solved from Past Papers By::: YASIR JAVAED Characteristics of searching an outside partner. (3 Marks) ...
No comments:
Post a Comment