BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Computer Science > BsCS 3rd Semester


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-11-2008, 07:25 PM
arslanbadar's Avatar
Little Baby

 
Join Date: Nov 2008
Age: 35
Posts: 2
Program / Discipline: BSCS
Class Roll Number: 07-42
arslanbadar is on a distinguished road
Default write a program to input visiting and perment employee record by insertion extertion

Code:
#include<iostream>
#include<string>
using namespace std;
class employee
{
public:
int id;
string name;
void setdata(int id0,string name0)
{
id=id0;
name=name0;
}
int getid()
{
return id;
}
string getname()
{
return name;
}
};
class eperment : public employee
{
public:
int sal,allow;
void setsal(int sal0)
{
sal=sal0;
}
void setallow(int allow0)
{
allow=allow0;
}
int getsal()
{
return sal;
}
int getallow()
{
return allow;
}
friend istream& operator >>(istream& is,eperment &a)
{
cout<<"Enter the id: ";
is>>a.id;
cout<<"Enter the name: ";
is>>a.name;
cout<<"Enter the sal: ";
is>>a.sal;
cout<<"Enter the allowances: ";
is>>a.allow;
return is;
}
friend ostream& operator <<(ostream& os,eperment &a)
{
cout<<endl<<" The id: ";
os<<a.id;
cout<<endl<<"The name: ";
os<<a.name;
cout<<endl<<"The sal: ";
os<<a.sal;
cout<<endl<<"The allowances: "<<endl;
os<<a.allow;
cout<<"Net Basic sal";
os<<a.sal+a.allow;
cout<<endl;
return os;
}
};
class evisit : public employee
{
public:
int hours,rph;
void setdata(int hours0,int rph0)
{
hours=hours0;
rph=rph0;
}
int gethours()
{
return hours;
}
int getrph()
{
return rph;
}
friend istream& operator >>(istream& is,evisit &b)
{
 
cout<<"Enter the id: ";
is>>b.id;
cout<<"Enter the name: ";
is>>b.name;
cout<<"Enter the hours: ";
is>>b.hours;
cout<<"Enter the Rate per hour: ";
is>>b.rph;
return is;
}
friend ostream& operator <<(ostream& os,evisit &b)
{
cout<<endl<<" The id: ";
os<<b.id;
cout<<endl<<"The name: ";
os<<b.name;
cout<<endl<<"The hours: ";
os<<b.hours;
cout<<endl<<"The Rate per hour: ";
os<<b.rph;
cout<<endl<<"Net amount is";
os<<b.hours * b.rph;
cout<<endl;
return os;
}
};
int main()
{
eperment a[2];
evisit b[2];
int i;
cout<<"Enter the perment emp data"<<endl;
for(i=0;i<2;i++)
{
cin>>a[i];
}
cout<<"Enter the visiting emp data"<<endl;
for(i=0;i<2;i++)
{
cin>>b[i];
}
int loc=0;
int large =a[0].sal+a[0].allow;
for(i=0;i<2;i++)
{
if(large<a[i].sal+a[i].allow)
{
large=a[i].sal+a[i].allow;
loc=i;
}
}
;
int loc1=0;
int large1 =b[0].hours*b[0].rph ;
for(i=0;i<2;i++)
{
if(large1<b[i].hours*b[i].rph )
{
large1=b[i].hours*b[i].rph ;
loc1=i;
}
}
if(a[loc].sal+a[loc].allow>b[loc1].hours*b[loc1].rph)
{
cout<<"The perment emp is greater sal"<<endl;
cout<<a[loc];
}
else
{
cout<<"The visit emp is greater sal"<<endl;
cout<<b[loc1];
}
/*cout<<"the perment emp data"<<endl;
for(i=0;i<2;i++)
{
cout<<a[i];
}
cout<<"the visiting emp data"<<endl;
for(i=0;i<2;i++)
{
cout<<b[i];
}
*/
return 0;
}
//contact me by 03226133632

Reply With Quote
Reply

Tags
employee, extertion, input, insertion, perment, program, record, visiting, write


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write C# student program using grade code thecool Visual Programming 0 17-06-2011 09:53 PM
Program to identify if an input is a symbol, digit or character bonfire Object Oriented Programming 0 09-03-2011 12:11 AM
Program to write in different fonts on the screen bonfire Object Oriented Programming 0 01-03-2011 03:02 PM
Mistakes made when visiting the Prophets Mosque usman_latif_ch Islam 0 18-12-2009 06:47 PM
Virtue of visiting the sick and the divine reward usman_latif_ch Islam 0 18-02-2009 07:00 AM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 05:39 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.