Advertisement
teo2mirce

Untitled

Feb 12th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. //Ron Aschnewitz & Mustafa Kadadah
  2. //Lab 4 problem 1
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. double wage (int salary, int hours=0 );
  8.  
  9. int main ()
  10. {
  11. int salary;
  12. int hours;
  13. char yn;
  14. double output;
  15.  
  16. cout.setf(ios::fixed);
  17. cout.setf(ios::showpoint);
  18. cout.precision(2);
  19. cout<<"Enter rate: $ ";
  20. cin>>salary;
  21. cout<<"Overtime? (y or n) :"<<endl;
  22. cin>>yn;
  23.  
  24.  
  25. if (yn=='n')
  26. {
  27. output= wage (salary );
  28. cout<<output<<endl; }
  29. else if (yn=='y')
  30. {
  31.  
  32. cout<<"Enter overtime hours: " << endl;
  33. cin>>hours;
  34. output= wage (salary, hours);
  35. cout<<output;
  36. }
  37.  
  38.  
  39. }
  40. double wage (int salary, int hours)
  41. {
  42. double output =0;
  43. output = ((salary*40.0)+((salary/2.0)+salary)*hours);
  44. return output;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement