Tip Calculator web app with html, css and plain javascript.
Design comparison
Solution retrospective
I seem to have gotten the total Amount wrong, I could not get the logic behind this, can anyone explain please?
Community feedback
- @arunsingh009Posted almost 3 years ago
Ok, @PeterScope your design looks cool I also have tried the same challenge but was unable to put that dolor logo and person logo in the input field in my challenge. Now, coming to your problem of the total amount, for total amount logic is very easy. First, calculate the total amount of tip which has to be divided into the number of people then add it to the bill amount and then divide the total amount by a number of people.
For your reference. Suppose Bill amount is 100 and you are selecting 5% tip then the total tip amount will be equal to 5 and suppose 5 people are sharing the amount then,
- total amount = 105.
- total tip amount = 5
- tip/person=5/5=1
- total amount/person = 105/5=21.
I hope this explanation helps I tried my best to make things clear for you.
Marked as helpful1@arunsingh009Posted over 2 years ago@PeterScope If this explanation is useful, please mark it as helpful so that I can determine whether I am good at explaining things or not.
0@peterkariolaPosted over 2 years ago@arunsingh009 Sorry for not reply yesterday. It is quite helpful, I was just waiting for me to work on it on github and see how it goes
Thanks for your help @arunsingh009, I am really grateful
0@arunsingh009Posted over 2 years ago@PeterScope your welcome buddy and do let me know once you try
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord