For this programming assignment, you'll be performing a programming practice called "refactoring", which means to improve the underlying code while maintaining the same function of the original. You'll be refactoring the cost estimator to check for valid user input in form fields rather than from the prompt function.
As with the previous assignment, this lab has multiple steps that require attention to detail. Work through it step by step and check your work regularly.
var hotelElem = document.getElementById("hotel"); hotel.code = hotelElem.options[hotelElem.selectedIndex].value; hotel.type = hotelElem.options[hotelElem.selectedIndex].text; displayCosts();
.toFixed(2)
method to format the value to reflect currency..toFixed(2)
method to format the value to reflect currency.+=
operator as a shortcut to building the "results" string:
results += "Your " + hotel.type + " Hotel Stay: ";
HTML, CSS, and JavaScript should be properly formatted following their respective coding conventions discussed in class.
You can use the live preview extension in VSCode to test the page as you're building (click Preview Available in the lower left of the VSCode window), but when you're finished, be sure to check the live URL at https://dci110w19.github.io/insiders-YOURUSERNAME/costestimator.html
(e.g. "https://dci110w19.github.io/insiders-mickelj/costestimator.html") to see that it is completely uploaded and working.
Your page should look similar to the following images depending on the user's choices:
You will be graded on:
The lab will begin with a full score of 75 points and deductions will be made according to the amount and severity of errors.