Hi guys, so I've designed a program to help me close the register at the end of the night. It works great except I have yet to implement the ability to determine how the credit card tips will be split via my program. (I work in a restaurant)I usually do it by hand by...
writing out the list of people who worked that day and how many hours they worked.
I then add their hours to get the total hours worked.
I then go to each employee on the list, divide their hours worked by total hours worked.
This provides me with the percentage amount that that employee gets of the total tips.
I do this for each employee and then multiply their percentages by the total tips in order to determine which person gets which amount of money. Should I create a loop that allows the user to create their chosen amount of "employee" classes and then the appropriate variables for each one? I'm worried about this because I'm not sure how to go about handling an unknown amount of classes as there are different amounts of employees that work each day. Any tips or advice?
Enter today tips: 120
Enter employee name (q to quit)
Max
Enter employee hours
6
Enter employee name (q to quit)
Joan
Enter employee hours
6
Enter employee name (q to quit)
Harry
Enter employee hours
5
Enter employee name (q to quit)
Tom
Enter employee hours
3
Enter employee name (q to quit)
q
Max earned 36
Joan earned 36
Harry earned 30
Tom earned 18