#include <iostream>
using namespace std;
float calculateCharges(float customer_time);
int main()
{
int number = 3;
float customer_fees[number];
float customer_times[number];
int i;
for(i = 0; i < number; i++)
{
cout << "Enter the time of parking of " << i+1 << " customer: ";
cin >> customer_times[i];
customer_fees[i] = calculateCharges(customer_times[i]);
}
for(i = 0; i < number; i++)
cout << "Customer's " << i+1 << " fee for " << customer_times[i] << " = " << customer_fees[i] << endl;
return 0;
}
float calculateCharges(float customer_time)
{
float amount = 12 + (0.9 * ((int)customer_time - 2));
if(amount > 20)
return 20;
else return amount;
}
Comments
Dear Buhlebendalo Hlwempu, Questions in this section are answered for free. We can't fulfill them all and there is no guarantee of answering certain question but we are doing our best. And if answer is published it means it was attentively checked by experts. You can try it yourself by publishing your question. Although if you have serious assignment that requires large amount of work and hence cannot be done for free you can submit it as assignment and our experts will surely assist you.
This code is not running on my laptop,it is saying that customer_time is not declared
Leave a comment