Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function addChar ( input , character ) { if ( input . value = = null | | input . value = = 0
function addCharinputcharacter ifinputvalue null inputvalue input.value character else input.value character function cosform formdisplay.value Mathcosformdisplay.value; function sinform formdisplay.value Mathsinformdisplay.value; function tanform formdisplay.value Mathtanformdisplay.value; function sqrtform formdisplay.value Mathsqrtformdisplay.value; function lnform formdisplay.value Mathlogformdisplay.value; function expform formdisplay.value Mathexpformdisplay.value; function deleteCharinput inputvalue inputvalue.substringinputvalue.length var val ; function percentinput val inputvalue; input.value inputvalue ; function changeSigninput ifinputvalue.substring input.value inputvalue.substringinputvalue.length else input.value inputvalue function computeform if val var percent formdisplay.value; percent pcentsubstringpercentindexOf; formdisplay.value parseFloatpercentval; val ; else form.display.value evalformdisplay.value; function squareform formdisplay.value evalformdisplay.valueevalformdisplay.value function checkNumstr for var i ; i strlength; i var ch strcharAti; if ch ch if ch && ch && ch && ch && ch && ch && ch&& ch alertinvalid entry!" return false return true In this part you are to develop a set of unit tests for a scientific calculator program written in JavaScript above. At first run the program. Try to use it to calculate some expressions. Then try to understand how does it work. Finally: aWrite a total of TESTS, organized into THREE sets. b Each test set should target one functional element of the program You CANNOT choose addition, subtraction, division and multiplication cWRITE the code that allows the program to PASS your tests. d Explain your APPROACH in each test set. What was your STRATEGY here? e Capture screenshots or console logs of the code BEFORE and AFTER it passed the tests, showing the OUTPUT of the unit testing library. THIS IS A MUST SO PLEASE INCLUDE THIS fShorten the output to the most important part, where it LISTS the number of tests passed and failed. ALREADY ANSWERS ARE GIVEN ON CHEGG BUT ARE WRONG SO DO NOT COPY.
function addCharinputcharacter
ifinputvalue null inputvalue
input.value character
else
input.value character
function cosform
formdisplay.value Mathcosformdisplay.value;
function sinform
formdisplay.value Mathsinformdisplay.value;
function tanform
formdisplay.value Mathtanformdisplay.value;
function sqrtform
formdisplay.value Mathsqrtformdisplay.value;
function lnform
formdisplay.value Mathlogformdisplay.value;
function expform
formdisplay.value Mathexpformdisplay.value;
function deleteCharinput
inputvalue inputvalue.substringinputvalue.length
var val ;
function percentinput
val inputvalue;
input.value inputvalue ;
function changeSigninput
ifinputvalue.substring
input.value inputvalue.substringinputvalue.length
else
input.value inputvalue
function computeform
if val
var percent formdisplay.value;
percent pcentsubstringpercentindexOf;
formdisplay.value parseFloatpercentval;
val ;
else
form.display.value evalformdisplay.value;
function squareform
formdisplay.value evalformdisplay.valueevalformdisplay.value
function checkNumstr
for var i ; i strlength; i
var ch strcharAti;
if ch ch
if ch && ch && ch && ch && ch
&& ch && ch&& ch
alertinvalid entry!"
return false
return true
In this part you are to develop a set of unit tests for a scientific calculator program written in JavaScript above. At first run the program. Try to use it to calculate some expressions. Then try to understand how does it work. Finally:
aWrite a total of TESTS, organized into THREE sets.
b Each test set should target one functional element of the program You CANNOT choose addition, subtraction, division and multiplication
cWRITE the code that allows the program to PASS your tests.
d Explain your APPROACH in each test set. What was your STRATEGY here?
e Capture screenshots or console logs of the code BEFORE and AFTER it passed the tests, showing the OUTPUT of the unit testing library. THIS IS A MUST SO PLEASE INCLUDE THIS
fShorten the output to the most important part, where it LISTS the number of tests passed and failed.
ALREADY ANSWERS ARE GIVEN ON CHEGG BUT ARE WRONG SO DO NOT COPY.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started