When you define an
, it already starts with the value of 0. Though, giving it the value of 0 is fine too! Just wanted to let you know, in case you didn't:)
Now, my skills are a little rusty, but I'll try to give you the best advice that I can. I also don't know how far you are in your homework, so if any of this hasn't been covered by your course yet, feel free to pick and choose what to use, depending on what you already know.
Your program will never get to your second function, because it is not called in
(of course, not called outside of what you have commented). Your second function must also be defined before
main, in order for it to it to work. You can either move your second function above main, or define it like this:
double ticketcalculation(double overlimit);
as long as it's before
If you'd like to brush up on your knowledge of functions:
Now, it's time to call your function,
double ticketcalculation(double overlimit)
Get it out of the comments! Try it out.
I almost forgot! Your if statements need a little help. You're on the right track, just not quite there.
if (overlimit >= 1 && overlimit <= 9)
fine = 0;
else if (fine > 10)
fine = 100.00;
else if (fine > 20)
fine = 150.00;
else if (fine >= 25)
fine = 250.00;
Read more about if statements here!
I tested it out myself, and it seems to work just fine:)
By the way, it's really recommended that you don't
use system functions. For pausing, I like to use
You'll need to
Read about it here!
I spent so long writing this, there were already two other answers by the time I finished lol.