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...
icon
Related questions
Question

Please. need help with this. I attached how the final image should look

  1. There are two logic errors in setting up the global constants. Locate and fix those errors.
  2. 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”
      1. If no exception is thrown then run the command totalCost += wgtBox.value * COST_PER_LB;.
      2. If an exception is caught, set the value of msgBox. inner HTML to the error message you defined for the thrown exception.
    1. Repeat Step 5, for the estimated distance cost using distBox.value. Throw the error message “!! Enter a positive mileage” for a caught exception.
  3. Save your changes to the file.
  4. Test your code by entering for the estimated weight and 1200 for the mileage. Confirm that the error message “!! Enter a positive weight” appears next to the total box.
  5. 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.
  6. Enter a mileage of 1200 miles and click the Setup and Installation box. Confirm that the estimated moving cost is calculated to be $2650
Figure 4-30
Completed Project 4-1
Hands-on Project 4-1
Moving Estimate
Estimated weight @ $0.50 per pound
Estimated distance @ $0.75 per mile
Setup and Installation (add $500)
Estimated Moving Cost
2500 lbs.
0 miles
$1750.00!! Enter a positive mileage
Transcribed Image Text:Figure 4-30 Completed Project 4-1 Hands-on Project 4-1 Moving Estimate Estimated weight @ $0.50 per pound Estimated distance @ $0.75 per mile Setup and Installation (add $500) Estimated Moving Cost 2500 lbs. 0 miles $1750.00!! Enter a positive mileage
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY