Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ User - Defined Functions I need a user defined function which determines whe

ID: 3830006 • Letter: C

Question

C++

User - Defined Functions

I need a user defined function which determines whether the entered income is a low or high income and then based on that calculates the hourly rate as per question below.

During the tax season, every Friday, the J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows:

If a person has low income (<= 25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise, the service charges are 40% of the regular hourly rate for the time over 30 minutes.

For others, if the consulting time is less than or equal to 20 minutes, there are no service charges; otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes.

(For example, suppose that a person has low income and spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is 70.00 * 0.40 * (45 / 60) = $21.00.)

Write a program that prompts the user to enter the hourly rate, the total consulting time, and whether the person has low income. 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.

Explanation / Answer

#include <iostream>

using namespace std;

float billingAmount(int rate, int conTime,int income);

int main()
{
int rate;
int conTime;
int income;
float amount;
  
cout<<"Please enter hourly rate";
cin>>rate;

cout<<" Please enter consulting time in minutes";
cin>>conTime;

cout<<" Please enter your income";
cin>>income;
  
amount = billingAmount(rate,conTime,income);
  
cout<<" Billing amount is "<<" "<<amount;
return 0;
}

float billingAmount(int rate, int conTime,int income)
{
float bilAmount;
  
if(income <= 25000)
{
if(conTime <= 30)
{
bilAmount = 0.0;
}
else
{
bilAmount = (0.40* rate*conTime)/60;
}
}

else
{
if(conTime <= 20)
{
bilAmount = 0.0;
}
else
{
bilAmount = (0.70*rate*conTime)/60;
}
}

return bilAmount;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote