by using functions, write a CPP program that calculates a water bill for a user. In order to compute the water bill, user needs to input the unpaid balance, the current and previous meter reading. RM1.10 will be charged for every thousand gallons. A surcharge of 2% is added to every unpaid balance.
.
my program doesn't seem to work. what are the mistakes?
#include <iostream.h>
#include <cmath>
using namespace std;
double unpaid(int a)
{
double unpaid;
unpaid=(float)(a+(a*(2/100)));
return unpaid;
}
double current(int b)
{
double current;
current=(b/1000)*1.10;
return current;
}
double previous(int c)
{
double previous;
previous=(c/1000)*1.10;
return previous;
}
int main(void)
{
double previous;
double current;
double unpaid;
cout<<"Please enter your unpaid balance in RM";
cin>>unpaid;
cout<<"Please enter your current meter reading in Gallons";
cin>>current;
cout<<"Please enter your previous meter reading in Gallons";
cin>>previous;
cout<<"Your bill is" " "<<unpaid+(current-previous);
system("pause");
return 0;
}