write a program that prompts the user to enter yearly income, the hourly rate, the total consulting time. the program should output the billing amount. your program must contain a function that takes as input the hourly rate, the total consulting time, and a value indicating whether the person has low income. the function should return the billing amount. your program may prompt the user to enter the consulting time in minutes.

Respuesta :

Using the knowledge in computational language in C++ it is possible to write a code that prompts the user to enter yearly income, the hourly rate, the total consulting time. the program should output the billing amount.

Writting the code:

#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);

       

       }

}

See more about C++ code at brainly.com/question/12975450

#SPJ1

Ver imagen lhmarianateixeira