this is the simple problem I'm working on.
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of 3 customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format. The program should use the function calculateCharges to determine the charge for each customer.
so far this is what I have been able to come up with when i run a syntax check a few errors pop up and I think its just something either I'm not understanding properly or Just don't see it.
these are the errors reported
8 C:\Users\peter\Desktop\petes programs\parking garage\main.cpp `rate' undeclared (first use this function)
#include <iostream>
27 C:\Users\peter\Desktop\petes programs\parking garage\main.cpp expected unqualified-id before '{' token
27 C:\Users\peter\Desktop\petes programs\parking garage\main.cpp expected `,' or `;' before '{' token
#include <iostream>
using namespace std;
double calculatecharges(double);
int main(int argc, char *argv[])
{
double hours; rate;
int x;
x=0;
do
{ cout<<"Enter number of hours parked: ";
cin>> hours;
rate = calculatecharges(double hours);
cout<< " your parking fee is :" << rate << endl;
x++;
} while (x<4) ;
system("PAUSE");
return EXIT_SUCCESS;
}
double calculatecharges(double hours) ;
{
double base_rate = 2;
double long_rate = .50;
double max_rate= 10;
if (hours>3)
rate=base_rate;
else if (hours>3)
rate=((hours-3)*long_rate + base_rate);
else (hours>11)
rate = max_rate;
}