Let's start by making a list of what things we know and what we need to do.
So we need to know these things from the user:
1) How many customers are at the table
2) The money each person at the table owes to the restaurant
3) What meals each person at the table had eaten (also ask how many of that meal)
4) Price of each meal eaten by each person
What we need to calculate:
1) Subtotal
2) Tax (6%)
3) Tip (if more than 5 people then 20% otherwise 18%)
4) Total
The output should look something like this, either you print each customer's bill separately while including meals(I guess that's what they want us to do because they are asking how much money each person owes separately otherwise) and then the subtotal, tax, tip, total. Otherwise you can display each meal separately and then display subtotal etc. (that's how it's supposed to work but I guess it's better you do the previous option).
So output would be like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
Customer 1:
Cockroach legs x2 - 1400 bitcoins
Insect feces x 1 - 5030 bitcoins
Total:- 5430 bitcoins
Customer 2:
Cockroach eyes x 2 = 1400 bitcoins
Insect overload x 1 - 20 bitcoins
Total:- 1420 bitcoins
Subtotal:- 6850 bitcoins
tax:- ...
tip:- ...
Total:- ...
| |
What if I don't want to give a tip.. no fair.
Now that you what to do, try to come up with what logic you will use. Hmm what might come handy over here.. for-loops?
After you're done post your code in
[code] [ /code] CODING TAGS (pls don't forget the tags) and then we'll correct you if you get it wrong.