Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstdlib>
  4. #include <string>
  5. #include <ctime>
  6. #include <fstream>
  7. #include <istream>
  8. #include "Libary_header.h"
  9. using namespace std;
  10.  
  11.  
  12. void getClientInfo(string& clientName, double& clientIncome, int& clientTime);
  13. double getCharges(double income, int time);
  14.  
  15. int main()
  16. {
  17. char question;
  18. string name;
  19. double income;
  20. int time;
  21.  
  22.  
  23. cout << "\nWould you like to enter information for the client? (Y for Yes, N for No)" << endl;
  24. question = readChar("Question", 'Y', 'N');
  25.  
  26. while (question == 'Y')
  27. {
  28.  
  29. getClientInfo(name, income, time);
  30. getCharges( income, time);
  31.  
  32.  
  33.  
  34. cout << "\nWould you like to enter another client's information?"<< endl;
  35. question = readChar("Question", 'Y', 'N');
  36. }
  37.  
  38.  
  39.  
  40. system("pause");
  41. return 0;
  42. }
  43.  
  44. void getClientInfo(string& clientName, double& clientIncome, int& clientTime)
  45. {
  46. cout << "\nEnter Clients Name: ";
  47. getline(cin, clientName);
  48.  
  49. // cout << "\nEnter Client's income between $15,000 and $100,000: ";
  50. // clientIncome = readDouble("Income", 15000, 100000);
  51. //
  52. // cout << "\nEnter Clients consulting time between 15 and 120 (2 hours) minutes: ";
  53. // clientTime = readInt("Time", 15, 120);
  54. }
  55.  
  56.  
  57.  
  58. double getCharges(double clientIncome, int clientTime)
  59. {
  60. double charges;
  61. double income;
  62. int time;
  63.  
  64. cout << "\nEnter Clients Income between $15,000, and $100,000: ";
  65. income = readDouble("Income", 15000, 100000);
  66.  
  67. cout << "\nEnter Clients consulting time between 15 and 120 (2 hours) minutes: ";
  68. time = readInt("Time", 15, 120);
  69.  
  70.  
  71. if (income <= 25000)
  72. {
  73. if (time <= 30)
  74. {
  75. cout << "Free Consulting" << endl;
  76. return 0;
  77. }
  78. else if (time >= 31 || time <=90)
  79. {
  80. time = time - 30;
  81. charges = 70 * 0.4 * (time / 60.0);
  82.  
  83. }
  84. else if (time >= 91)
  85. {
  86. time = time - 30;
  87. charges = 70 * 0.4 * (time / 120.0);
  88. }
  89.  
  90. }
  91. else if (income >25000)
  92. {
  93. if (time <= 20)
  94. {
  95. cout << "Free Consulting" << endl;
  96. return 0;
  97. }
  98. else if (time >= 21 || time <= 80)
  99. {
  100. time = time - 20;
  101. charges = 70 * 0.7 * (time / 60.0);
  102. }
  103. else if (time >= 81)
  104. {
  105. time = time - 20;
  106. charges = 70 * 0.7 * (time / 120.0);
  107. }
  108. }
  109.  
  110. cout << fixed << setprecision(2) << "\nThe amount to charge for this client is: $ " << charges << endl;
  111.  
  112.  
  113. return charges;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement