question archive During the tax season, every Friday, the J & J tax accounting firm provides assistance to people who prepare their own tax returns

During the tax season, every Friday, the J & J tax accounting firm provides assistance to people who prepare their own tax returns

Subject:Computer SciencePrice:2.86 Bought8

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

a. If a person has slowed on 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.

b. 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 is spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is $70.00 x 40 x (45/60) = $21.00).

This will make a program that prompts the user to enter the hourly rate, the total Consulting time, and whether the person has a low income. The program should output the building of Mount, the program must contain a function that takes as input the hourly rate, the 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.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

#include <iostream>// to provide basic input and output services.
#include <iomanip>//to define the manipulator functions used ahead in the program.

using namespace std;//provides a scope to the identifiers

// declaring billing_amount function
double billing_amount(double hour_rate, int yearly_income, int consultant_time);

int main()
{
  double hour_rate;
  int consultant_time,yearly_income;//declaring the variables

  cout << fixed << showpoint << setprecision(2);/*We have used setprecision to limit the floating numbers after decimal
 to 2 .The fixed, showpoint and setprecision are used to manipulate the format. For more information, you can refer C++ documentation*/

  cout << "Enter yearly income: ";
  cin >> yearly_income;//Taking the value of yearly income from user

  // set lowIncome

  cout << "Enter the hourly rate: ";
  cin >> hour_rate;//Taking the value of hourly rate from user


  cout << "Enter consulting time in minutes: ";
  cin >> consultant_time;//Taking the value of consultancy rate from user

  // calling billing_amount function  
  cout << "The total billing amount is: $";
  cout << billing_amount(hour_rate, yearly_income, consultant_time);
  cout << "."
     << endl;
 return 0;
}
//defining the billing_amount function
double billing_amount(double hour_rate, int yearly_income, int consultant_time)
{
  
  if (yearly_income<=25000)//Checking the condition for low income
  {  
    if (consultant_time<=30)//Checking if the consulting time is less than or equal to 30 mins.
     return 0;//returning service charges as zero as per the condition
    else
     return hour_rate * ((double)(consultant_time - 30)/60) * 0.4;
     /*Calculating the billing amount for low income and for consultancy time more than 
     30 mins and subtracting 30 from the consultancy time to calculate the hours that needs to be charged.I have divided the time by 60 to convert minutes into hours. I have also used explicit type conversion to make it of double data type.*/
  }
  else
  {
    if (consultant_time<=20)
      return 0;//returning service charges as zero as per the condition
    else
       return hour_rate * ((double)(consultant_time - 20)/60) * 0.7;
/*Calculating the billing amount for income more than 25,000 and for consultancy time more than 
     20 mins and subtracting 20 from the consultancy time to calculate the hours that needs to be charged.I have divided the time by 60 to convert minutes into hours. I have also used explicit type conversion to make it of double data type.*/  }

 }