robbiemcleod56
New member
- Joined
- Aug 7, 2018
- Messages
- 14
I need help writing an equation, it's just too complicated for me to trust my end work.
I am writing a program to keep track of when people check in, and how much to charge them for their time stayed. The formula has to calculate how much they need to pay based on the following rules:
A deposit of $8 is taken in advance to cover up to 4 hours during the day between 7AM and 6PM.
1 hour or less is $3. If they leave before this time, they get the rest of their deposit back. 2 hours or less is $5, and 4 hours is the full $8.
Once they exceed this time before 6PM, it turns to a $15 flat rate (current deposit+$7). Past 6PM, another $5 is added to the current deposit, and that covers another 4 hours. If they exceed 4 hours past 6PM, an additional $10 is added to the current deposit, and that lasts until 7AM. The charge will continue at that point as the rules stated above.
It may help if you have some programming experience, or if you could write this in the format of if this, then add that, that would help me a lot, try to use words as where the numbers are stored. I'm more having problems with the time. I don't know how to write the equation to accept the different number of hours throughout the day.
I am writing a program to keep track of when people check in, and how much to charge them for their time stayed. The formula has to calculate how much they need to pay based on the following rules:
A deposit of $8 is taken in advance to cover up to 4 hours during the day between 7AM and 6PM.
1 hour or less is $3. If they leave before this time, they get the rest of their deposit back. 2 hours or less is $5, and 4 hours is the full $8.
Once they exceed this time before 6PM, it turns to a $15 flat rate (current deposit+$7). Past 6PM, another $5 is added to the current deposit, and that covers another 4 hours. If they exceed 4 hours past 6PM, an additional $10 is added to the current deposit, and that lasts until 7AM. The charge will continue at that point as the rules stated above.
It may help if you have some programming experience, or if you could write this in the format of if this, then add that, that would help me a lot, try to use words as where the numbers are stored. I'm more having problems with the time. I don't know how to write the equation to accept the different number of hours throughout the day.