# Yet Another Tip Calculator

- overview
- sales tax
- splitting
- tip fraud
- tip calculation

## User Guide

### Notes on Splitting

YATC allows you to split the check total evenly between all guests. The picker wheel on the right allows you to choose the number of guests. The per-person total is calculated by dividing the check total, which is the subtotal + the tip amount, by the number of guests. This sounds simple enough, but there are two important caveats to keep in mind.

#### Caveat #1

Checksum, palindrome, or rounding tip methods can be applied to the check total or per-person total; swiping your finger across the results area changes the target. Swiping from the left to the right sets the per-person total as the target. Swiping from the right to the left sets the check total as the target.

When applying these methods to the check total, the check total might not equal:

Similarly, the tip total might not equal:

For example, let's say six friends go out to dinner. They each order the exact same item — the all-you-can-eat lobster buffet — and the check subtotal with tax is $216.23. They decide Dean will charge the amount to his credit card and the others will pay him back. Dean thinks the server looks a bit shifty and, being the only one of the group with an iPhone, whips out this trusty app. He selects the checksum method for the tip calculation; the resulting checksum total is $255.22, with a per-person total of $42.54. You will probably notice that 6 × $42.54 = $255.24, which is slightly greater than $255.22.

In this scenario, modifying the check total to equal the (per-person total × the number of people) will break the checksum (or palindrome or rounded amount), and will require recalculation of the checksum. A new checksum will trigger recalculation of new per-person amounts, and the cycle will continue until we find a checksum total that is evenly divisible by the number of guests. Adding this functionality would negatively affect the performance of the app. We made a decision that the current solution, where the per-person amount × number of people is close, if not exactly equal, to the check total, was best.

When applying these methods to the total amount per person, the check total will equal:

Similarly, the tip total will equal:

Let's continue with the above example. While Dean is using this app to calculate the checksum total, the other five are searching for cash in their wallets, but none of them has enough to pay Dean back immediately. Since Dean doesn't like people owing him money, they ask the server to provide separate checks, which will allow them each to charge their portion. They agree with Dean's assessment of the sketchy server, so they ask him to calculate the checksum on the per-person amount. While he could re-enter the subtotal amount per person based on the new checks, it is faster for him to calculate the checksum results per person by swiping his finger to the right across the already calculated results. The finger swipe will switch the checksum target to the per-person total rather than the check total. The new per-person total, with the checksum applied, is $42.56, and the check total is $255.36, which is equal to 6 × $42.56.

Although the above example uses checksum, the same concepts apply to palindrome and rounding.

#### Caveat #2

If the check total is a multiple of the number of guests, but the subtotal is not, then the tip amount per person will not exactly equal (the tip percent × the subtotal per person).

For example, let's say three friends go out for lunch. The subtotal is $40.00, and they want to tip 20%. The subtotal for each person, prior to applying the tip, would be $40.00/3 = $13.34 (rounding up from $13.333333...). The check total would be $40.00 + (0.20)×$40.00 = $48.00. The total amount for each person is $48.00/3 = $16.00. The tip amount per person is $16.00-$13.34 = $2.66, which is not exactly (0.20)×($13.34)=$2.67 (rounded up from $2.6680).