Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- double calculateBill(int income, int consultingMinutes, double hourlyRate);
- int main()
- {
- int income, consultingMinutes;
- double hourlyRate;
- cout << "Please enter the clients income: $" ;
- cin >> income;
- cout << "Please enter the consulting time in minutes: ";
- cin >> consultingMinutes;
- cout << "Please enter the hourly rate: $";
- cin >> hourlyRate;
- cout << fixed << showpoint << setprecision(2);
- cout << "Your total bill ammount comes to: $" << calculateBill(income, consultingMinutes, hourlyRate) << endl;
- return 0;
- }
- double calculateBill(int income, int consultingMinutes, double hourlyRate)
- {
- if (income <= 25000)
- {
- if (consultingMinutes <= 30)
- return 0;
- else
- return hourlyRate * 0.40 * ((consultingMinutes - 30) / 60);
- }
- else {
- if (consultingMinutes <= 20)
- return 0;
- else
- return hourlyRate * 0.70 * ((consultingMinutes - 20) / 60);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement