discussion question 1330
JavaScript can add another dimension to our sites with simple math calculations, such as working with conditionals for an order form to add the proper taxes or currency conversions. Letâ€s return to QVR Tours for this thread and write someJavaScript 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
Discounts a tour if there are more than 8 people attending (you decide on the discount)
Can be very basic
examples
const discount=150;
var totalCost = 0;
const tourCost= 2500;
const tourCost2=3500;
const conciergeFee1=150;
const conciergeFee2=300;;
const ticketAfterDiscount =0;
var firstName = prompt (“Enter first nameâ€);
var lastName= prompt (“Enter Last nameâ€);
var tourPrice = (“Enter the amount of the ticketâ€);
if (tourPrice < tourCost && tourPrice < tourCost2);
{
tourPrice = totalCost;
cosole.log(“Total Cost = $†tourPrice);
}
else if (tourPrice > tourCost && tourPrice < tourCost2);
{
tourPrice = totalCost + conciergeFee1;
cosole.log(“Total Cost = $†tourPrice);
}
else if (tourPrice > tourCost && tourPrice > tourCost2);
{
tourPrice = totalCost + conciergeFee2;
cosole.log(“Total Cost = $†tourPrice);
}
else
{
cosole.log(“Invalid Entryâ€);
}
var personsInGroup = (“Enter number of people in groupâ€);
if (personsInGroup > 8)
{
ticketAfterDiscount = totalCost + discount;
cosole.log(“Total Cost = $†ticketAfterDiscount);
}
else
{
ticketAfterDiscount = totalCost;
cosole.log(“Price after discount = $†ticketAfterDiscount);
}
Var nameOfGuest = firstName+ lastName;
console.log(“ Thank you†nameOfGuest “your total cost is $†ticketAfterDiscount);
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!
Use Discount Code “Newclient”for a 15% Discount!”
We have Walden University and Capella University nursing practitioners!