Answer to Question #1286 in C++ for samali

Question #1286
Write a program that reads an employee name, salary and degree. Then increase the salary as following :
& & & & & & & & degree & & & increase&
& & & & & & & & 1 & & & & & & 70%
& & & & & & & & 2 & & & & & & 50%
& & & & & & & & 3 & & & & & & 30%
& & & & & & & & 4 & & & & & & 15%
& & & & & & & & &
& Print the name and the new salary for any input ?
1
Expert's answer
2011-01-06T12:01:47-0500
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout<<"Enter employee name (1 word), salary and degree
->";
string name;
double salary;
int degree;

cin>>name>>salary>>degree;
switch (degree)
{
case 1: salary*=1.7; break;
case 2: salary*=1.5; break;
case 3: salary*=1.3; break;
case 4: salary*=1.15; break;
default: cout<<"Wrong degree
";
}
cout<<name<<" "<<salary<<endl;
system("pause");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS