Wednesday, January 5, 2011

[discussion_vu] CS201 IDEA SOL SHARED BY NAVEED

CS201

#include<iostream.h>
#include<string.h>
#include<conio.h>

class calsalary
{
    private:
        int empID,empGrade;
        char empName[20];
        int salary;
      public:
          calsalary()
          {
              empID=0;
              empGrade=0;
              strcpy(empName," ");
              salary=0;
          }
          void getData()
          {
              cout<<"please enter employee ID:";
              cin>>empID;
              cout<<"Please enter employee Name:";
              cin>>empName;
              cout<<"Please enter employee Grade:";
              cin>>empGrade;
          }
          int calculate(int grade)
          {
              switch(grade)
              {
                  case 17:
                      salary=15000+(15000*45/100);
                      break;
                  case 18:
                      salary=20000+(20000*45/100);
                      break;
                  case 19:
                      salary=25000+(25000*45/100);
                      break;
                  default:
                      cout<< "Your typed Grade in not listed";
                      break;
         }
         return salary;
     }
     void setData()
     {
         cout<<"The net salary of" <<empName << " is Rs." <<calculate(empGrade)<<endl;
     }
    
     ~calSalary()
     {
     }
 };
 int main(void)           
 {
     calSalary obj1;
     obj1.getData();
     obj1.setData();
    
     system("pause");
     return 0;
 }





*~ WS ~*
*~ Devil Jin ~*
*
Bscs 4th Semester *

--
You received this message because you are subscribed to the Google Groups "Virtual University of Pakistan" group.
To post to this group, send email to discussion_vu@googlegroups.com.
To unsubscribe from this group, send email to discussion_vu+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/discussion_vu?hl=en.

No comments:

Post a Comment

PAID CONTENT