Hey guys, newly registered but regular lurker, I am having a problem with a script I'm writting for uni, the question is as follows:
During the tax season, an accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows:
a. 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.
Write a program that prompts the user to enter the hourly rate, total consulting time, and whether the person has low income. the program should output the billing information.
(Now the rest of the questions says that this all needs to be done by using functions but I am really rusty in C++ as I haven't done it for a while and wanted to try and make this program work another way before I even touch on my functions again because at the moment I cant even get my functions to output the value of an integer variable and its really killing my morale, so any help here guys would be much appreciated, PS not asking people for the answer just want some guiding points towards the right direction)
And this is what I have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <iostream>
using namespace std;
int main()
{
double hRate = 0, cTime = 0, bAmount = 0;
char iRate, l, h;
cout << "Please enter the hourly rate: ";
cin >> hRate;
cout << "Please enter total consulting time in minutes: ";
cin >> cTime;
cout << "Is the income rate low or high (l - Low | h - High): ";
cin >> iRate;
if (iRate == l && cTime > 30)
bAmount = (hRate * 40) * ((cTime / 60) - 30);
else if (iRate == h && cTime > 20)
bAmount = (hRate * 70) * ((cTime / 60) - 20);
cout << bAmount << endl;
system("pause");
return 0;
}
|