Question: Please use notepadd + + and coding language is javascript and html . Create two appropriately labeled textboxes on your Webpage. Use the ONCHANGE attribute

Please use notepadd++ and coding language is javascript and html.Create two appropriately labeled textboxes on your Webpage.
Use the ONCHANGE attribute to convert the binary number in one box to the decimal in the other, and vice versa.
The binary number will have to be stored and represented as a decimal whose digits are constrained to the values of zero and one.
E.g. binary five [101] is stored as decimal one hundred one.
The numeric value is constrained to one byte of storage so that the maximum is a non-negative decimal integer between zero and 255 inclusive [0..255].
The maximum binary representation is therefore 11111111.
Therefore, use the alert() function to complain to the user that their input data is outside the specified ranges.
(Because we have restricted the number of binary digits to a maximum of eight, there is no need to use a repetition statement.)
Use another alert() to indicate that a digit value is illegal when expecting a binary digit ( i.e., not 0 and not 1)
Label each text box appropriately, i.e. each textbox should be labeled with its respective base and valid input range.
E.g. Base 10[0..255]
Ensure that identifiers in your code (e.g. variable and function names) are labeled appropriately.
Use a separate function for base conversion in each direction respectively.
Base your program on this Lab8 code template.
Extra Credit: use the JavaScript switch statement to convert either the decimal or binary value additionally to and from hexadecimal via two single-character text boxes.
Thank you. i am going to attach the template
onchange base conversion template
function validateDigitInBase( digit, base )
{
if()
{
alert();
}
}
function convertBinaryToDecimal( binaryValue )
// Assumes that binaryValue is a decimal value where each decimal digit represents a binary digit
{
// constants
var SOURCE_BASE =2;
var DESTINATION_BASE =10;
var DISPLAY_BASE =10;
// local variables
var placeValue =1; // initialized to the multiplicative identity
var decimalValue =0; // initialized to the additive identity
var digit;
digit = ; // extracting the rightmost DISPLAY_BASE (simulated binary) digit
validateDigitInBase(,); // ensuring that the new digit is valid in the SOURCE_BASE
decimalValue += ; // adding the new digit scaled by its SOURCE_BASE place value
placeValue *= ; // updating the SOURCE_BASE place value
binaryValue = ; // the decimal (simulated binary) value without the rightmost DISPLAY_BASE digit
// repeat the above code block seven more times
return decimalValue;
}
function convertDecimalToBinary( decimalValue )
{
// constants
var SOURCE_BASE =10;
var DESTINATION_BASE =2;
var DISPLAY_BASE =10;
// local variables
var placeValue =1; // initialized to the multiplicative identity
var binaryValue =0; // initialized to the additive identity
// Assumes that binaryValue is a decimal value where each decimal digit represents a binary digit
var digit;
digit = ; // extracting the rightmost DESTINATION_BASE digit
validateDigitInBase(,); // ensuring that the new digit is valid in the DESTINATION_BASE
binaryValue += ; // adding the new digit scaled by its DISPLAY_BASE place value
placeValue *= ; // updating the DISPLAY_BASE place value
decimalValue = ; // the decimal value without the rightmost DESTINATION_BASE digit
// repeat the above code block seven more times
return binaryValue;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!