Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstdlib>
- #include <string>
- #include <ctime>
- #include <fstream>
- #include <istream>
- #include "Libary_header.h"
- using namespace std;
- void getClientInfo(string& clientName, double& clientIncome, int& clientTime);
- double getCharges(double income, int time);
- int main()
- {
- char question;
- string name;
- double income;
- int time;
- cout << "\nWould you like to enter information for the client? (Y for Yes, N for No)" << endl;
- question = readChar("Question", 'Y', 'N');
- while (question == 'Y')
- {
- getClientInfo(name, income, time);
- getCharges( income, time);
- cout << "\nWould you like to enter another client's information?"<< endl;
- question = readChar("Question", 'Y', 'N');
- }
- system("pause");
- return 0;
- }
- void getClientInfo(string& clientName, double& clientIncome, int& clientTime)
- {
- cout << "\nEnter Clients Name: ";
- getline(cin, clientName);
- // cout << "\nEnter Client's income between $15,000 and $100,000: ";
- // clientIncome = readDouble("Income", 15000, 100000);
- //
- // cout << "\nEnter Clients consulting time between 15 and 120 (2 hours) minutes: ";
- // clientTime = readInt("Time", 15, 120);
- }
- double getCharges(double clientIncome, int clientTime)
- {
- double charges;
- double income;
- int time;
- cout << "\nEnter Clients Income between $15,000, and $100,000: ";
- income = readDouble("Income", 15000, 100000);
- cout << "\nEnter Clients consulting time between 15 and 120 (2 hours) minutes: ";
- time = readInt("Time", 15, 120);
- if (income <= 25000)
- {
- if (time <= 30)
- {
- cout << "Free Consulting" << endl;
- return 0;
- }
- else if (time >= 31 || time <=90)
- {
- time = time - 30;
- charges = 70 * 0.4 * (time / 60.0);
- }
- else if (time >= 91)
- {
- time = time - 30;
- charges = 70 * 0.4 * (time / 120.0);
- }
- }
- else if (income >25000)
- {
- if (time <= 20)
- {
- cout << "Free Consulting" << endl;
- return 0;
- }
- else if (time >= 21 || time <= 80)
- {
- time = time - 20;
- charges = 70 * 0.7 * (time / 60.0);
- }
- else if (time >= 81)
- {
- time = time - 20;
- charges = 70 * 0.7 * (time / 120.0);
- }
- }
- cout << fixed << setprecision(2) << "\nThe amount to charge for this client is: $ " << charges << endl;
- return charges;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement