ADVERTISEMENT

One of the works done by our Robotics and Machine Learning division,
SELF-LEVELING QUADCOPTER
Arduino based Quadcopter.
Self-leveling is acheived by the aligning the quadcopter using the readings from the gryo as well as the accelerometer.
A four channel RC transmitter is used to control the movement of the quadcopter when in flight. Kindly subscribe to our YouTube Channel and stay tuned.

Friday 29 April 2016

CSE1002:PP8:Special Pay Increase Problem

CSE1002 Special Pay Increase Problem 

Employees in a company are up for a special pay increase. Given a file, with each line consisting of an employee's last name, first name, current salary, and percent pay increase, write a C++ program to compute the revised pay of each employee.
            Miller Andrew     65875.87  5
            Green Sheila     75892.56 6
            Sethi Amit        74900.50 6.1.
For example, the pay increase for Andrew is 5%.
UML:
 
CODE:
void employee::get(ifstream &f)
{
f>>firstName;
f>>lastName;
f>>salary;
f>>inc;
}
void employee::update_Sal()
{
updated_Salary=salary+salary*inc/100;
}
void employee::print()
{
cout<<firstName<<endl<<lastName<<endl<<fixed<<setprecision(2)<<updated_Salary<<endl;
}
int main()
{
char s[100];
ifstream f;
cin>>s;
f.open(s,ios::in);
employee e[100];
int i=0;
while(!f.eof())
{
e[i].get(f);
e[i].update_Sal();
e[i].print();
i++;
}
return 0;
}

No comments:

Post a Comment