Answer to Question #24295 in C++ for sarah

Question #24295
write a c++ program that will input employee name, rate per hour, number of hours worked and will compute the daily wage of an employee. if the number of hours worked exceeds eight hours add 30% to each excess hours as an overtime rate.
formula: daily wage=rate per hour x number of hours worked + OT pay.
1
Expert's answer
2013-02-26T08:38:10-0500
#include<iostream>
#include <string>
using namespace std;

int main() {
string name;
double rate, hours;
cout << "Enter employee name: ";
cin >> name;
cout << "Enter rate per hour: ";
cin >> rate;
cout << "Enter number of hours: ";
cin >> hours;
if (hours>8) {
cout << "Daily wage is:
";
cout <<
rate*hours+1.3*rate*(hours-8);
}
else {
cout << "Daily wage is:
";
cout << rate*hours;
}
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
APPROVED BY CLIENTS