Create a page that will allow users to enter the total amount for a bill, the number of people splitting the bill, and the tip percentage that should be used. All of these values can be entered using text fields, but you may use a drop-down menu or radio buttons to allow the user to select the tip amount that they want to use. When the user clicks a button to calculate the amount it should call a function in an associated JavaScript file that will perform the calcuation. This function should have four parameters, the first which is the amount of the bill, the second of which is the tax rate, the third of which is the number of people splitting the bill, and the last of which is the desired tip rate. The function should calculate the total amount due including tax and split it evenly amongst everyone. The tip should be calculated without tax. The function should create and return a String that looks similar to the following:    "The bill of $100.00 with 8% tax comes to a total of $108.00. With 4 people splitting the bill, each person should pay $27.00 for the meal. Each person should also leave $5.00 towards the 20% tip, for a total of $33.00 per person."

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a page that will allow users to enter the total amount for a bill, the number of people splitting the bill, and the tip percentage that should be used. All of these values can be entered using text fields, but you may use a drop-down menu or radio buttons to allow the user to select the tip amount that they want to use. When the user clicks a button to calculate the amount it should call a function in an associated JavaScript file that will perform the calcuation. This function should have four parameters, the first which is the amount of the bill, the second of which is the tax rate, the third of which is the number of people splitting the bill, and the last of which is the desired tip rate. The function should calculate the total amount due including tax and split it evenly amongst everyone. The tip should be calculated without tax. The function should create and return a String that looks similar to the following: 

 

"The bill of $100.00 with 8% tax comes to a total of $108.00. With 4 people splitting the bill, each person should pay $27.00 for the meal. Each person should also leave $5.00 towards the 20% tip, for a total of $33.00 per person." 

 

Your page can use the alert function to display this message as a pop-up. Alternatively you can write it directly to page or otherwise put the information into various form components if you'd like. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Properties of CSS
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education