Please. need help with this. I attached how the final image should look There are two logic errors in setting up the global constants. Locate and fix those errors. Go to the calcTotal() To guard against users entering a zero or negative value for the estimated weight, replace the statement totalCost += wgtBox.value * COST_PER_LB; with a try catch statement that does the following: 0. Tests whether wgtBox.value is not greater than 0 by using the expression ! (wgtBox.value > 0). If that expression is true, throw an exception with the error message “!! Enter a positive weight” If no exception is thrown then run the command totalCost += wgtBox.value * COST_PER_LB;. If an exception is caught, set the value of msgBox. inner HTML to the error message you defined for the thrown exception. Repeat Step 5, for the estimated distance cost using distBox.value. Throw the error message “!! Enter a positive mileage” for a caught exception. Save your changes to the file. Test your code by entering 0 for the estimated weight and 1200 for the mileage. Confirm that the error message “!! Enter a positive weight” appears next to the total box. Change the weight to 2500 and enter a 0 for the estimated mileage. Confirm that the error message “!! Enter a positive mileage” appears next to the total box. Enter a mileage of 1200 miles and click the Setup and Installation box. Confirm that the estimated moving cost is calculated to be $2650
Please. need help with this. I attached how the final image should look There are two logic errors in setting up the global constants. Locate and fix those errors. Go to the calcTotal() To guard against users entering a zero or negative value for the estimated weight, replace the statement totalCost += wgtBox.value * COST_PER_LB; with a try catch statement that does the following: 0. Tests whether wgtBox.value is not greater than 0 by using the expression ! (wgtBox.value > 0). If that expression is true, throw an exception with the error message “!! Enter a positive weight” If no exception is thrown then run the command totalCost += wgtBox.value * COST_PER_LB;. If an exception is caught, set the value of msgBox. inner HTML to the error message you defined for the thrown exception. Repeat Step 5, for the estimated distance cost using distBox.value. Throw the error message “!! Enter a positive mileage” for a caught exception. Save your changes to the file. Test your code by entering 0 for the estimated weight and 1200 for the mileage. Confirm that the error message “!! Enter a positive weight” appears next to the total box. Change the weight to 2500 and enter a 0 for the estimated mileage. Confirm that the error message “!! Enter a positive mileage” appears next to the total box. Enter a mileage of 1200 miles and click the Setup and Installation box. Confirm that the estimated moving cost is calculated to be $2650
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please. need help with this. I attached how the final image should look
- There are two logic errors in setting up the global constants. Locate and fix those errors.
- Go to the calcTotal() To guard against users entering a zero or negative value for the estimated weight, replace the statement totalCost += wgtBox.value * COST_PER_LB; with a try catch statement that does the following: 0. Tests whether wgtBox.value is not greater than 0 by using the expression ! (wgtBox.value > 0). If that expression is true, throw an exception with the error message “!! Enter a positive weight”
-
- If no exception is thrown then run the command totalCost += wgtBox.value * COST_PER_LB;.
- If an exception is caught, set the value of msgBox. inner HTML to the error message you defined for the thrown exception.
- Repeat Step 5, for the estimated distance cost using distBox.value. Throw the error message “!! Enter a positive mileage” for a caught exception.
-
- Save your changes to the file.
- Test your code by entering 0 for the estimated weight and 1200 for the mileage. Confirm that the error message “!! Enter a positive weight” appears next to the total box.
- Change the weight to 2500 and enter a 0 for the estimated mileage. Confirm that the error message “!! Enter a positive mileage” appears next to the total box.
- Enter a mileage of 1200 miles and click the Setup and Installation box. Confirm that the estimated moving cost is calculated to be $2650
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY