Advertisement
Guest User

wage calc

a guest
Jan 22nd, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #include <iostream>;
  2. #include <cmath>;
  3.  
  4. using namespace std;
  5. int main()
  6. {
  7. std::basic_istream<char>;
  8. std::char_traits<char>;
  9.  
  10. double hours{}, wage{}, wage15{}, wage2{}, holiday2{}, bday{}, totalwage{}, holiday{}, birthdaywagey{}, birthdaywage{}, totalholiday{}, endtotal{}, endtotalwage{}, y{}, n{}; \
  11. double overtime{}, overtime2{};
  12. char op{};
  13.  
  14. cout << " How many hours did you work this week? ";
  15. cin >> hours;
  16. overtime = (hours > 40 < 60);
  17.  
  18. overtime2 = (hours > 60 < 80);
  19.  
  20. cout << "\n What is your hourly wage? ";
  21. cin >> wage;
  22. if (hours > 40 < 60) {
  23. wage15 = wage * 1.5;
  24. }
  25. else if (hours > 60 < 80) {
  26. wage2 = wage * 2;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. cout << "\n Were any of the hours holiday hours? If so, how many? ";
  34. cin >> totalholiday;
  35. holiday = overtime - totalholiday;
  36. holiday2 = holiday * (wage * wage);
  37.  
  38.  
  39. cout << "\n Was it your birthday this week? [y/n] ";
  40. cin >> y;
  41. cin >> n;
  42. if (cin >> y) {
  43. birthdaywagey = (wage * 0.7);
  44. }
  45. if (cin >> n) {
  46. birthdaywage = 0;
  47. }
  48.  
  49.  
  50.  
  51.  
  52. totalwage = (hours * wage) + (overtime * wage15) + (holiday2);
  53. endtotalwage = totalwage + birthdaywagey;
  54.  
  55. cout << "\n You earned: " << endtotalwage << endl;
  56.  
  57.  
  58.  
  59.  
  60. system("pause");
  61. return 0;
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement