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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!