Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. double calculateBill(int income, int consultingMinutes, double hourlyRate);
  7.  
  8. int main()
  9. {
  10. int income, consultingMinutes;
  11. double hourlyRate;
  12.  
  13. cout << "Please enter the clients income: $" ;
  14. cin >> income;
  15. cout << "Please enter the consulting time in minutes: ";
  16. cin >> consultingMinutes;
  17. cout << "Please enter the hourly rate: $";
  18. cin >> hourlyRate;
  19. cout << fixed << showpoint << setprecision(2);
  20. cout << "Your total bill ammount comes to: $" << calculateBill(income, consultingMinutes, hourlyRate) << endl;
  21. return 0;
  22. }
  23.  
  24. double calculateBill(int income, int consultingMinutes, double hourlyRate)
  25. {
  26. if (income <= 25000)
  27. {
  28. if (consultingMinutes <= 30)
  29. return 0;
  30. else
  31. return hourlyRate * 0.40 * ((consultingMinutes - 30) / 60);
  32. }
  33. else {
  34. if (consultingMinutes <= 20)
  35. return 0;
  36.  
  37. else
  38. return hourlyRate * 0.70 * ((consultingMinutes - 20) / 60);
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement