Hello, the debugging question is in the screenshot and I included the HTML and JS below, thank you! HTML            Hands-on Project 4-5                   Hands-on Project 4-5               Angular Degrees (°) to Circular Radians (rad) Converter                             Angle in Degrees                                ↔                       Angle in Radians                                                       Enter an angular degree or a circular radian in either input box and press Tab to convert.           JAVASCRIPT "use strict"; // Function to convert degrees to radians  function degreesToRadians(degrees) {    return degrees*PI/80; } // Function to convert radians to degrees function radiansToDegrees(radians) {    return radians*180/PI; } // Event handler that converts radians to degrees when the input box is changed document.getElementById("rValue").onchange = function( {    let radians = document.getElementById("rValue").value;    document.getElementById("aValue").value = formatValue3(radiansToDegrees(radian)); } // Event handler that converts degrees to radians when the input box is changed document.getElementById("aValue").onchange = function() {    let degrees = document.getElementById("aValue").value;    document.getElementById("rValue").value = formatValue3(degreesToRadians(degrees); }   /* ================================================================= */  // Function to display a numeric value in the format ##.###   function formatValue3(value) {     return value.toFixed(3);  }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Hello, the debugging question is in the screenshot and I included the HTML and JS below, thank you!

HTML

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8" />
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
   <title>Hands-on Project 4-5</title>
   <link rel="stylesheet" href="styles.css" />
   <script src="project04-05_txt.js" defer></script>
</head>

<body>
   <header>
      <h1>Hands-on Project 4-5</h1>
   </header>

   <article>
      <h2>Angular Degrees (&#176;) to Circular Radians (rad) Converter</h2>
      <form>
         <div>
            <h3>Angle in Degrees</h3>
            <input type="number" id="aValue" value="90" />
         </div>
         <div id="arrow">&harr;</div>
         <div>
            <h3>Angle in Radians</h3>
            <input type="number" id="rValue" value="1.5708" />            
         </div>
     </form>
     <footer>
        Enter an angular degree or a circular radian in either input box and press Tab to convert.
     </footer>
   </article>
</body>
</html>

JAVASCRIPT

"use strict";

// Function to convert degrees to radians 
function degreesToRadians(degrees) {
   return degrees*PI/80;
}

// Function to convert radians to degrees
function radiansToDegrees(radians) {
   return radians*180/PI;
}

// Event handler that converts radians to degrees when the input box is changed
document.getElementById("rValue").onchange = function( {
   let radians = document.getElementById("rValue").value;
   document.getElementById("aValue").value = formatValue3(radiansToDegrees(radian));
}

// Event handler that converts degrees to radians when the input box is changed
document.getElementById("aValue").onchange = function() {
   let degrees = document.getElementById("aValue").value;
   document.getElementById("rValue").value = formatValue3(degreesToRadians(degrees);
}

 

/* ================================================================= */
 // Function to display a numeric value in the format ##.### 
 function formatValue3(value) {
    return value.toFixed(3);
 }

 

Directly below the command that declares the radians variable, insert a command that writes the radians value
to the debugger console in the form: "Radians = radians".
Directly below the command that declares the degrees variable, insert a command that writes the degrees value
to the debugger console in the form: “Degrees = degrees".
Save your changes to the file and then load project04-05.html in your web browser.
Use the debugger to locate syntax and runtime errors in the code. Fix those errors in your code editor.
Enter 60 in the Angle in Degrees box. The value for Angle in Radians should be 1.047, but it is not. Locate and fix
the logic error that resulted in the incorrect value being calculated.
Transcribed Image Text:Directly below the command that declares the radians variable, insert a command that writes the radians value to the debugger console in the form: "Radians = radians". Directly below the command that declares the degrees variable, insert a command that writes the degrees value to the debugger console in the form: “Degrees = degrees". Save your changes to the file and then load project04-05.html in your web browser. Use the debugger to locate syntax and runtime errors in the code. Fix those errors in your code editor. Enter 60 in the Angle in Degrees box. The value for Angle in Radians should be 1.047, but it is not. Locate and fix the logic error that resulted in the incorrect value being calculated.
Expert Solution
Step 1

The following are the errors that needs to be fixed in the javascript file.

1. Missing closing bracket in the line

document.getElementById("rValue").onchange = function() {

2. Missing closing braacket in the line

document.getElementById("rValue").value = formatValue3(degreesToRadians(degrees));

3. changing of variable name to radians in the line

4. PI value is not defined> we can use Math.PI

return degrees*(Math.PI/180);

5. The logical error is 80 is there instead of 180.

return degrees*(Math.PI/180);

After doing the changes the javascript code is

"use strict";

// Function to convert degrees to radians
function degreesToRadians(degrees) {
return degrees*Math.PI/180;
}

// Function to convert radians to degrees
function radiansToDegrees(radians) {
return radians*180/Math.PI;
}

// Event handler that converts radians to degrees when the input box is changed
document.getElementById("rValue").onchange = function() {
let radians = document.getElementById("rValue").value;
console.log("Radians ="+radians);
document.getElementById("aValue").value = formatValue3(radiansToDegrees(radians));
}

// Event handler that converts degrees to radians when the input box is changed
document.getElementById("aValue").onchange = function() {
let degrees = document.getElementById("aValue").value;
console.log("Degrees = "+degrees);
document.getElementById("rValue").value = formatValue3(degreesToRadians(degrees));
}

/* ================================================================= */
// Function to display a numeric value in the format ##.###
function formatValue3(value) {
return value.toFixed(3);
}
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Form and its Elements
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education