ok this is my first time asking for help but if someone could help me i would appreciate this.
I have to make a program that calculate parking ticket prices
minimal price for parking is 2 $
maximum price is 10$
fixed price is 2$ for 1-3 hours if you stay longer price goes up for 0.50 each hour max stay time 24 h
You're telling the program. price != 10 But what is this price? Becuase price is nothing, you just create it double price; but do nothing with it. So just initialize the price in the beginning.
double price = 0;
Edit: Also the math is a but off. It should be - price = (h*0.50) + 0.5;
Edit 2: Also, this will never happen
1 2 3 4
elseif (price = 10)
{
price = 10;
}
Because of this
elseif (h > 3 && price != 10 && h<24)
You're telling it to enter this statement, if hour is between 3 and 24. Which is where 10 is. But it will always choose this one over the other one. So switch their places.