Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what am I doing wrong? 15265: Scripting Technologies Javascript: Metric Converter ( 50 points +5 excr.) 2023 Create a web page to help people with

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

what am I doing wrong?

15265: Scripting Technologies Javascript: Metric Converter ( 50 points +5 excr.) 2023 Create a web page to help people with conversions from English measurements to Metric. When loaded, the page will allow the user to select one of three conversion types: Fahrenheit to Celsius temperatures, Miles to Kilometers, or Ounces to Grams. A starter html page has been provided with the assignment, which appears as follows: English to Metric Converter English to Metric Select the conversion and enter the English measurement you wish to convert: Conversion type: Fahrenheit To Celsius Miles To Kilometers Ounces To grams Result: Build your application in netbeans as a simple HTML type project, the following features should be present: - Use a lavascript file called convert.js to store the conversion functions. Each function should accept the English measurement value and return the metric result - On the result values, round to 3 decimal positions (not shown in the example below) - Perform data validation as discussed below The conversion functions are: - The formula for f-to-C conversion is: Celsius =( Fahrenheit 32)5/9 - The formula for Miles to Kilometers: Kilometers = Miles * 1.6 - The formula for Ounces to Grams: Grams = ounces * 28.35 The screen calls the appropriate conversion function based on an 'on click' event for the convert button shown above. As noted, all JavaScript code functions should be put in the convert.js file. In addition, the program should do the following: - Check that a value has been entered in the input text area; if it has not, produce an 'alert' popup stating that the box is empty or the value is illegal Add an additional data validation function so that zero or negative values are not accepted for miles or ounces conversions, and a number below 459.67 Fahrenheit is rejected (i.e., below absolute zero). Use radio buttons (as shown) to indicate which conversion is desired (this will require you to examine the value of the selection group inside the Javascript in order to call the correct function) Clear the text boxes and return the cursor to the input text box when the clear button is clicked; reset: the radio buttons to default. Build and display an output string similar to the example shown (which repeats the selected English value along with the metric name). Part A: conversion of F to C temperatures Part B: the remaining two conversion processes English to Metric Select the conversion and enter the English measurement you wish to convert: Conversion type: Fahrenheit To Celsius Miles To Kilometers Ounces To grams Select the converaion and enter the Einglish measurement you wish to convert: Conversion type: Fahrenheit To Celsius - Miles To lometers Ounces To grams: Result: 179miles=286.400Kilometers English to Metric Select the conversion and enter the English measurement you wish to convert: Conversion type: Fahrenheit To Celsius Miles To Kilometers Ounces To grams Result: 8 ounces =226.800grams. Extira Credit ( 5 pts) Add a new conversion function that does the reverse for temperatures: i.e, converts Celsius back to Fahrenheit. You do not need to adjust headings or user instructions, but your page should still validate input so that Celsius values below absolute zero are rejected with an error pop-up. Source History function Ftoc(ftemp) \{ varc=( ftemp 32.0)(5.0/9.0); return c; \} function MtoK (mi, ki) varc=(mi1.6); return c ; ) function ctoF (ctemp) \{ /1 9/5 varc= ctemp 9.0/5.0+32; return c; ) function otog(oz, gr) \{ 119/5 varc=oz28.35; return c; \} function isvalid(val, floor), \& if (val Converter.js Start Page U Source History [C.if(isnan(iv))alert("pleaseenteranumericstartingvalue");initv.focus();return;) var CT= document.getelementsByname ("cType"); //returns an array of the radio buttons if (cTo]. checked) 1 alert ("xou asked for F to C") ; if (isvalid (iv, 459.67)){ f elsel alert ("Temp cannot se bejow absolute zero (459.67)"); ) \}else if (cT.[1] . checked) if (isvalid (i,i)) ) fin s("resultin) \} eliserif alert ("Numbersi cannot be negatives"in); Jelsemif (eT [2] : checked) a lert (HYou askediffon ouncest to gramin); ive (isvalid (iv))l 3 erse.t alert ("Numbers cannot be negatives"); 53F Sunny eads English to Metric converter Khisenglish to Metrice/his Spsselect the conversion and enter the English measurement you wish to convert:cbr>c/p>? stoxm name=" convform" id="convForm ep>conversion type: ebr se/ps" p cinput typen"radio" id="toc" names"ctype" value-"tocelsiua">Fahrenheit. To Celsius Miles To Kilometers celsius to Fahrenheit br>br> kbr >cbr >/p> p>Result; \&r >c/p> "input type ="text" id="result" name=" result" atyle=" Midth: 300p2 ": cinput type="button" id="elear" name="elear" value="clear">

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions