I'm a newbie and I can't understand the errors in my program
maybe i should just change my major! lol well...the exercise asks us to calculate charges for a parking garage. there's a $2.00 minimum fee for less than 3 hours, and a $0.50 charge for each additional hour, but the charge can't exceed $10.00. they want it in this kind of format:
Car Hours Charges
1 1.5 2.00
2 4.0 2.50
3 24.0 10.00
TOTAL 29.5 14.50
and this is what i have so far...laugh if u want...i'm so lost. i can't even tell if i've declared my variables right, or if my functions even work...i get continuous errors and don't know where to start. if there's any way anyone can help me, i'd greatly appreciate it.
/* Calculate the total charges and the total hours for the parking garage. */
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int charges (chargesa, chargesb, chargesc)
int totalhours (a, b, c)
int calculatecharges (chargesa, chargesb, chargesc)
int main()
{
int a, b, c;
cout<<"Enter the number of hours for CAR 1:";
cin>>a;
cout<<"Enter the number of hours for CAR 2:";
cin>>b;
cout<<"Enter the number of hours for CAR 3:";
cin>>c;
return 0;
}
int charges (chargesa,chargesb,chargesc)
{
int chargesa = a * 0.50
if (a <= 3)
chargesa = 2.00
if (a > 3)
chargesa = (a - 3) * 0.50
if (chargesa >= 10.00)
chargesa = 10.00
int chargesb = b * 0.50
if (b <= 3)
chargesb = 2.00
if (b > 3)
chargesb = (b - 3) * 0.50
if (chargesb >= 10.00)
chargesb = 10.00
int chargesc = c * 0.50
if (c <= 3)
chargesc = 2.00
if (c > 3)
chargesc = (c - 3) * 0.50
if (chargesc >= 10.00)
chargesc = 10.00
cout<<"CAR 1 CHARGES:"<<chargesa;
cout<<"CAR 2 CHARGES:"<<chargesb;
cout<<"CAR 3 CHARGES:"<<chargesc;
}
int totalhours (a, b, c)
{
int totalhours = a + b + c
}
int calculatecharges (chargesa, chargesb, chargesc)
{
int calculatecharges = chargesa + chargesb + chargesc
}
P.S. - ur more than welcome to comment with ur opinion on whether or not i should change my major...especially after reading that code
:p
ok this is what i have now
/* Calculate the total charges and the total hours for the parking garage. */
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int charges (chargesa, chargesb, chargesc)
int totalhours (a, b, c)
int calculatecharges (chargesa, chargesb, chargesc)
int main()
{
int a, b, c;
cout<<"Enter the number of hours for CAR 1:";
cin>>a;
cout<<"Enter the number of hours for CAR 2:";
cin>>b;
cout<<"Enter the number of hours for CAR 3:";
cin>>c;
return 0;
}
int charges (chargesa,chargesb,chargesc)
{
int chargesa = a * 0.50
if (a <= 3)
chargesa = 2.00;
if (a > 3)
chargesa = ((a - 3) * 0.50) + 2.00;
if (chargesa >= 10.00)
chargesa = 10.00;
int chargesb = b * 0.50
if (b <= 3)
chargesb = 2.00;
if (b > 3)
chargesb = ((b - 3) * 0.50) + 2.00;
if (chargesb >= 10.00)
chargesb = 10.00;
int chargesc = c * 0.50
if (c <= 3)
chargesc = 2.00;
if (c > 3)
chargesc = ((c - 3) * 0.50) + 2.00;
if (chargesc >= 10.00)
chargesc = 10.00;
cout<<"CAR 1 CHARGES:"<<chargesa;
cout<<"CAR 2 CHARGES:"<<chargesb;
cout<<"CAR 3 CHARGES:"<<chargesc;
}
int totalhours (a, b, c)
{
int totalhours = a + b + c;
}
int calculatecharges (chargesa, chargesb, chargesc)
{
int calculatecharges = chargesa + chargesb + chargesc;
}
is that what u meant?