You have too many
types of things in there. Just make everything a double.
Yes, your severWage calculation is wrong. Write it down as an equation on a piece of paper and compare.
Part of the problem is your choice of names is not exact. (Learning to be exact takes some effort.)
For example, you have:
“hour” — but it is really
minutes in an hour
“overtime” — this appears to be the amount extra you get paid per hour. Try to think of a more exact name.
“severPay” and “serverWage” — both express the same concept, but one is being used for pay without overtime and one is pay with overtime.
“totalServer” — how is this different from “serverWage”
It helps to write your equations down on a piece of paper first.
server's-pay
= (rate-per-hour * min( number-of-hours-worked, minimum-hours-before-overtime )
+ (rate-per-hour * overtime-percentage * max( 0, number-of-hours-worked - minimum-hours-before-overtime ))
Does that look right?
Now you can assign values to you numbers:
minimum-hours-before-overtime = 7.5 // for daily calculations
rate-per-hour = 18.50 // presidential rate? nice paycheck for a server!
overtime-percentage = 1.5 // time and a half
(daily/weekly input)
number-of-hours-worked = ?
Now at the end of the day / end of the week, the café manager can calculate how much money he needs to fork over to each employee. For multiple people all working together, you can multiply in the number of people required for the event:
number-of-servers = ?
total-cost-to-pay-servers = server's-pay * number-of-servers
These names may seem ridiculous, and you can certainly cut them down, but... why?
1 2 3 4 5 6 7
|
double total_cost_to_pay_servers;
double number_of_servers;
double servers_pay;
...
(and so on)
...
double number_of_guests;
|
Hope this helps.