So I need the program to execute either one of the if statements that meet the conditions I've put. The input I used was 70, 15, and 30,000.It should go into the second if statement.Here is the code.
#include <iostream>
#include <fstream>
using namespace std;
int information1(int hourR);
int information2(int conTime);
int information3(int income1);
int hourR,conTime,income1;
ofstream outfile;
int information1(int hourR)
{
cout<<"Enter hourly rate.";
cin>>hourR;
return hourR;
}
int information2(int conTime)
{
cout<<"Enter total consulting time in minutes.";
cin>>conTime;
return conTime;
}
int information3(int income1)
{
cout<<"Enter income.";
cin>>income1;
return income1;
}
int main()
{
int hours,consultTime,income,fortyPercent,seventyPercent;
outfile.open("Billing amount.txt");
hours=information1(hourR);
consultTime=information2(conTime);
income=information3(income1);
if(income<=25000) {
if(consultTime<=30) {
outfile<<"No service charge.";
}
else {
fortyPercent=hours*.4*45/60;
outfile<<fortyPercent;
}
}
else
{
if(consultTime<=20){
outfile<<"No service charge.";
}
else
{
seventyPercent=hours*.7*45/60;
outfile<<seventyPercent;
}
}
outfile.close();
return 0;
}
Also can any1 tell me whether im doing the calculations right?becuz its confusing me,here is the problem.
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:
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.
(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*0.40*(45 / 60)= $21.00.)