Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int calculation (int, int, char);
  4.  
  5.  
  6. int main()
  7. {
  8.     //input vars
  9.     int hourlyRate, consTime;
  10.     char incomeDet;
  11.  
  12.  
  13.     // input fuctions
  14.  
  15. cout << "\nPlease enter the hourly rate: ";
  16. cin >> hourlyRate;
  17. cout << "\nPlease enter the total time in consultation in minutes: ";
  18. cin >> consTime;
  19. cout << "\nIs the client a low income client? (Y or N) ";
  20. cin >> incomeDet;
  21. // end input function
  22. cout << "\nYour bill is : " << calculation (hourlyRate, consTime, incomeDet) ;
  23.  
  24.  
  25.     return 0;
  26. }
  27.  
  28.  
  29. int calculation (int& hourlyRate, int& consTime, char& incomeDet)
  30. {
  31.     double billCalculation, conversionTime;
  32.     const double lowInClient = 0.40;
  33.     const double highInClient = 0.70;
  34.  
  35.  
  36.     if (incomeDet == 'y')
  37.     {
  38.  
  39.         if (consTime > 30 )  
  40.         {
  41.             conversionTime = (hourlyRate * lowInClient);
  42.             billCalculation = (conversionTime * (consTime - 30));
  43.  
  44.             cout << "\nYour billing amount is :" << billCalculation;
  45.         }// greater than 30 mins   
  46.  
  47.     } else if (consTime > 20 ) //end low endcome calc
  48.             {// high endcome calculations
  49.  
  50.  
  51.                     conversionTime = (hourlyRate * highInClient);
  52.                     billCalculation = (conversionTime * (consTime - 20));
  53.                     cout << "\nYour billing amount is :" << billCalculation;
  54.  
  55.  
  56.             }else // end else1
  57.                 {
  58.                     billCalculation = 0;
  59.                 }
  60. //end calc func
  61.  
  62. return 10;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement