Method Deck / finance
Tip and split a bill
Computes the tip amount, the total bill, and each person's even share when a bill is split among a number of people.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
- bill_amount (number, currency units, required) min 0 : Pre-tip bill amount
- tip_percent (number, %, required) min 0 : Tip percentage
- number_of_people (integer, required) min 1 : Number of people splitting the bill evenly
Outputs
- tip_amount (currency units): Total tip amount
- total_amount (currency units): Bill plus tip
- amount_per_person (currency units): Even share of the total per person
Steps
- Convert the tip percent to a decimal: t = tip_percent / 100.
- tip_amount = bill_amount * t.
- total_amount = bill_amount + tip_amount.
- amount_per_person = total_amount / number_of_people.
- Round tip_amount, total_amount, and amount_per_person to 2 decimals (money to cents).
Constants
None.
Sources
Worked example and test vectors
| Name | Inputs | Answer |
| worked example | {"bill_amount":84.5,"tip_percent":18,"number_of_people":4} | Tip $15.21, total $99.71, $24.93 per person |
| test vector: single diner, no tip | {"bill_amount":20,"tip_percent":0,"number_of_people":1} | Tip $0.00, total $20.00, $20.00 per person |
Published card
- Address:
86950c0de7f0e2d7475eaad57723775a
- Made at:
2026-09-30T22:39:30.722Z
- Method sha256:
99269013230ed5b5e5e7ee55c64e529cc29b04fccbb4bd1d6e43135544811a1e