Question
Let's return to QVR Tours for this thread and write some JavaScript that will assist in the following calculations: Add a concierge fee of $150
Let's return to QVR Tours for this thread and write some JavaScript that will assist in the following calculations:
- Add a concierge fee of $150 to tours that cost more than $2,500 and a fee of $300 if a tour costs more than $3,500.
- Concatenate a traveler's first and last name.
Discount a tour if there are more than eight people attending (you decide on the discount).
EXAMPLE:
Javascriptto calculate number of guest on going on a tour and if greater than eight, there's a surcharge/concierge fee.
function tourguestcost() {
var first = document.getElementById("firstname").value;
var second = document.getElementById("lastname").value;
document.getElementById("name").innerHTML = first+" "+second;
var guest = document.getElementById(*totalguest).value;
var tourcost = guest * 100;
var totalsurcharge = tourcost;
if (tourcost >= 2500 && tourcost <= 3500)
{
totalsurcharge = tourcost + 150;
}
If (tourcost >= 3500)
{
totalsurcharge = tourcost+300;
}
If (guest > 8)
{
totalsurcharge = totalsurcharge * .20
people = "Number of guest exceed 8. Surcharge added. "
} else {
people = "Enjoy the tour with a surcharge.. "
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started