function addChar ( input , character ) { if ( input . value = = null |
Fantastic news! We've Found the answer you've been seeking!
Question:
function addCharinput character
ifinputvalue null input.value
input.value character
else
input.value character
function cosform
form.display.value Math.cosformdisplay.value;
function sinform
form.display.value Math.sinformdisplay.value;
function tanform
form.display.value Math.tanformdisplay.value;
function sqrtform
form.display.value Math.sqrtformdisplay.value;
function lnform
form.display.value Math.logformdisplay.value;
function expform
form.display.value Math.expformdisplay.value;
function deleteCharinput
input.value input.value.substring input.value.length
var val ;
function percentinput
val input.value;
input.value input.value ;
function changeSigninput
ifinputvalue.substring
input.value input.value.substring input.value.length
else
input.value input.value
function computeform
if val
var percent form.display.value;
percent pcent.substringpercentindexOf;
form.display.value parseFloatpercent val;
val ;
else
form.display.value evalformdisplay.value;
function squareform
form.display.value evalformdisplay.value evalformdisplay.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. At first run the program. Try to use it to calculate some expressions. Then try to understand how does it work. Finally:
Write a total of tests, organized into three sets.
Each test set should target one functional element of the program You cannot choose and
Write the code that allows the program to pass your tests.
Explain your approach in each test set. What was your strategy here?
Capture screenshots or console logs of the code before and after it passed the tests, showing the output of the unit testing library. Shorten the output to the most important part, where it lists the number of tests passed and failed.
Related Book For
Corporate Finance
ISBN: 9781265533199
13th International Edition
Authors: Stephen Ross, Randolph Westerfield, Jeffrey Jaffe
Posted Date: