Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ron Aschnewitz & Mustafa Kadadah
- //Lab 4 problem 1
- #include <iostream>
- using namespace std;
- double wage (int salary, int hours=0 );
- int main ()
- {
- int salary;
- int hours;
- char yn;
- double output;
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- cout<<"Enter rate: $ ";
- cin>>salary;
- cout<<"Overtime? (y or n) :"<<endl;
- cin>>yn;
- if (yn=='n')
- {
- output= wage (salary );
- cout<<output<<endl; }
- else if (yn=='y')
- {
- cout<<"Enter overtime hours: " << endl;
- cin>>hours;
- output= wage (salary, hours);
- cout<<output;
- }
- }
- double wage (int salary, int hours)
- {
- double output =0;
- output = ((salary*40.0)+((salary/2.0)+salary)*hours);
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement