I need help with my program. When I run the program I input the yearly income and it skips to "Enter consulting time in minutes: ". Does not allow me to input the hourly rate. This is what I have so far :

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question
100%

Programming Exercise C++

Summary

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 X.40 X (45/60) = $21.00.)

Instructions

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.

I need help with my program. When I run the program I input the yearly income and it skips to "Enter consulting time in minutes: ". Does not allow me to input the hourly rate. This is what I have so far : 

#include <iostream>
#include <iomanip>

using namespace std;

double billingAmount (double hRate, int consTime, int yearlyInc);

int main() 
{
  double hRate;
  int consTime;
  int yearlyInc;

  cout << fixed << showpoint << setprecision(2);

  cout << "Enter yearly income: ";
  cin >> yearlyInc;
  cout << endl;

  cout << "Enter the hourly rate: ";
  cin >> hRate;
  cout << endl;

  cout << "Enter consulting time in minutes: ";
  cin >> consTime;
  cout << endl;

  cout << "The billing amount is: " << billingAmount(hRate, consTime, yearlyInc) << endl;
    
    return 0;
}
  
  double billingAmount (double hRate, int consTime, int yearlyInc)
{
  if (yearlyInc <= 25000) {
      if (consTime <= 30)
        return 0;
      else
        return hRate * ((double)(consTime - 30) / 60) * 0.40;
}
  else {
    if (consTime <= 20)
      return 0;  
    else 
      return hRate * ((double)(consTime - 20) / 60) * 0.70;
}

}
 
 
Output :
Enter yearly income: 50000.00
 
Enter the hourly rate:
Enter consulting time in minutes: 80
The billing amount is: 0.00

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning