I'm tracking raffle tickets for local church. This year the price of a ticket is $10 or 3 for $20.
Next year the price maybe $5 or 6 for $22. The user enters the the ticket price's and the prices are stored in a database. As the tickets are sold the user will enter the number of $10 tickets and the number or 3 for $20 packs. The app will then ask them to enter the raffle ticket info i.e. Ticket number, buyer info, seller info. Then this info along with the ticket price will be stored in a database. The problem I am having is trying to calculate the ticket price of the 3 for $20 tickets without hard coding the price. i.e. Ticket 1 price is $6.67 ticket 2 price is $6.67 and ticket 3 price is $6.66 which totals $20. I can hard code this without a problem but I don't want to change this every year. Dose anyone know of a mathematical formula or code that will figure out the cost of each ticket no matter what the number for dollars is?
Thanks