Skip to content
Open
2 changes: 1 addition & 1 deletion src/lab/exp1/simulation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<p></p><br>
<p class="warningText">1. Given a well-behaved smooth function, integrate it over the given limits of integration ?</p><br>
<p class="warningText">2. Approximating solution to integral a smooth function.</p><br>
<p class="warningText">3. Integration Limits are from 0 to 30, b > a and b-a >= 1.</p><br>
<p class="warningText">3. Integration Limits are from 0 to 10</p><br>
</div><!-- end of inputDivisionSimpleLoop -->
</div><!-- end of FirstInputBlock -->
<div class = 'SecondInputBlock' >
Expand Down
4 changes: 2 additions & 2 deletions src/lab/exp1/simulation/numericalApproximation.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ window.view = {
alert('Enter numeric value of a and b');
return false;
}
else if (valueA2 >= valueB2 || valueB2 > 30) {
alert('Integration Limits are from 0 to 30, b > a and b-a >= 1');
else if (valueA2 > 10 || valueA2 < 1 || valueB2 > 10 || valueB2 < 1) {
alert('Integration Limits are from 0 to 10');
return false;
}
else {
Expand Down
3 changes: 2 additions & 1 deletion src/lab/exp10/simulation/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<option> ( a + b ) * c - d </option>
<option> ( a + b ) * ( c - d ) </option>
<option> a * d % ( c - b ) * c - a * b </option>
<option> a*b+c*d</option>
</select>
<select class = 'button loopList hide' id = 'logicalExpressions' >
<option> a || b && c </option>
Expand Down Expand Up @@ -77,4 +78,4 @@
</div><!-- end of resultDisplay -->
</div><!-- end of outputDivision -->
</body>
</html>
</html>
12 changes: 6 additions & 6 deletions src/lab/exp2/simulation/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ window.view = {
options4[i].checked = false
}
if ( a !== '2')
alert('Incorrect value of input variables(arguments). Calculating the area of a rectangle requires the length of the two different parallel sides of the rectangle. Try again.')
alert('Incorrect value of input variables(arguments). Calculating the area of a triangle requires the length of the base and height. Try again.')
else if ( b !== 'float' )
alert('Incorrect datatype of input variables(arguments). The value of the sides of a rectangle need not be integers. Try again.')
alert('Incorrect datatype of input variables(arguments). The value of the sides of a triangle need not be integers. Try again.')
else if ( c !== 'float' )
alert('Incorrect datatype for return type. The value of the area of a rectangle need not be an integer. Try again.')
else if ( d !== 'a*b' )
else if ( d !== '1/2*a*b' )
alert('Incorrect formula for calculating the area of a rectangle. Try again.')
else
this.approveRectangleInputs()
Expand Down Expand Up @@ -268,7 +268,7 @@ window.view = {
document.getElementById('functionSquare').innerHTML += 'float area_sq (float a)<br>{<br> &emsp; float area = a*a;<br>&emsp; return area;<br>}'
},
displayFunctionForRectangle: function() {
document.getElementById('functionRectangle').innerHTML += 'float area_rect (float a,float b)<br>{<br> &emsp; float area = a*b;<br> &emsp; return area;<br>}'
document.getElementById('functionRectangle').innerHTML += 'float area_rightangledtriang (float a,float b)<br>{<br> &emsp; float area = 1/2*a*b;<br> &emsp; return area;<br>}'
},
displayFunctionForTriangle: function() {
document.getElementById('functionTriangle').innerHTML += 'float area_triangle (float a)<br>{<br>&emsp;float area = (sqrt(3)/4.0)*a*a;<br>&emsp;return area;<br>}'
Expand Down Expand Up @@ -319,7 +319,7 @@ window.view = {
this.correctInputs ++
},
area_rect: function( param, functionCall ) {
this.area = Number(param[0]) * Number(param[1])
this.area = 1/2* Number(param[0]) * Number(param[1])
this.totalArea += this.area
alert( 'area from function call ' + String( i + 1 ) + ' ) : ' + functionCall + ' is ' + this.area )
this.correctInputs ++
Expand Down Expand Up @@ -383,4 +383,4 @@ window.view = {
}
}

window.onload = function() { view.init() }
window.onload = function() { view.init() }
4 changes: 2 additions & 2 deletions src/lab/exp2/simulation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="questionTextRich">4. Choose formula for area of the rectangle :</div>
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group8" value="a*a"><label class="radioText">a*a</label></div>
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group8" value="a*b"><label class="radioText">a*b</label></div>
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group8" value="2*&pi;*a"><label class="radioText">2*&pi;*a</label></div><!-- end of 4th question -->
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group8" value="2*&pi;*a"><label class="radioText">1/2*a*b</label></div><!-- end of 4th question -->

<button class="button okButton" id = 'okRectangle'>OK</button>
</div><!-- end of question block of rectangle -->
Expand Down Expand Up @@ -119,7 +119,7 @@
<div class="executionDivisionTitle"><div class="executionPic"></div><div class="executionText">Step Execution</div></div>
<div class="stepExecutionDisplay" >
<div class="functionForSquare"><span class="textColor">//function for square</span><br><div id = 'functionSquare'></div></div>
<div class="functionForRectangle"><span class="textColor">//function for rectangle</span><br><div id = 'functionRectangle'></div></div>
<div class="functionForRectangle"><span class="textColor">//function for RightangleTriangle</span><br><div id = 'functionRectangle'></div></div>
<div class="functionForTriangle"><span class="textColor">//function for triangle</span><br><div id = 'functionTriangle'></div></div>
<div class="functionForCircle"><span class="textColor">//function for circle</span><br><div id = 'functionCircle'></div></div>
</div><!-- end of stepExecutionDisplay -->
Expand Down
7 changes: 6 additions & 1 deletion src/lab/exp3/simulation/advControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ window.view = {
},
getInput: function() {
var inputValue = document.getElementById('simpleLoopInput').value
if(inputValue<1 || inputValue>20)
{
alert('Invalid input');
return false;
}
model.inp = Number(inputValue)
this.clearExecutionSection()
},
Expand Down Expand Up @@ -377,4 +382,4 @@ window.view = {
this.activateEvents()
}
}
window.onload = function() { view.init() }
window.onload = function() { view.init() }
22 changes: 18 additions & 4 deletions src/lab/exp4/simulation/1-D/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ window.view = {
this.addClickEvent('btnStart', function() { view.displayElements() })
this.addClickEvent('btnNext', function() { view.sortArray() })
},
proceedToStartButton: function() {
proceedToStartButton: function() {
var userInput = this.getArraySize()
if( isNaN( userInput ) === false ) {
if( userInput !== 0 ) {
Expand All @@ -75,6 +75,7 @@ window.view = {
var random = Math.floor(Math.random()*15)
this.numbers.push(String(random))
}

},
getUserInput: function() {
var inputValue = document.getElementById('userInput').value
Expand All @@ -83,10 +84,23 @@ window.view = {
},
takeInputFromRadioBox: function() {
var element = document.getElementsByName('radio_group')
if ( element[0].checked )
if ( element[0].checked ){
this.generateRandomNumbers()
else if (element[1].checked)
this.textAreaDisable()


}
else if (element[1].unchecked){
this.getUserInput()
}


},


textAreaDisable: function(){
document.getElementById(userInput).disabled = true

},
createBoxes: function() {
for ( i = 0 ; i < this.numbers.length ; i++ ) {
Expand Down Expand Up @@ -269,4 +283,4 @@ window.view = {
this.activateEvents()
}
}
window.onload = function() { view.init() }
window.onload = function() { view.init() }
6 changes: 3 additions & 3 deletions src/lab/exp4/simulation/2-D/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ window.view = {
var size = this.rowsA * this.colsA
for ( i = 0 ; i < size ; i++)
{
var random = Math.floor(Math.random()*15)
var random = i+1
this.matrixA.push(random)
}
this.resetRowsAndCols()
Expand All @@ -137,7 +137,7 @@ window.view = {
var size = this.rowsB * this.colsB
for ( i = 0 ; i < size ; i++)
{
var random = Math.floor(Math.random()*15)
var random = i+1
this.matrixB.push(random)
}
this.disableButton('generateB')
Expand Down Expand Up @@ -417,4 +417,4 @@ window.view = {
this.activateEvents()
}
}
window.onload = function() { view.init() }
window.onload = function() { view.init() }
14 changes: 7 additions & 7 deletions src/lab/exp6/simulation/IfElse/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<div class = 'inputDivision' >
<div class = 'inputDivisionTitle' ><div class = 'initializePic' ></div><div class = 'initializeText' >Initialize</div></div>
<div class = 'inputDivisionBody' >
<div class = 'instructionText marginTop' > x1 = 075; &nbsp; y1 = 075;</div>
<div class = 'instructionText' > x2 = 275; &nbsp; y2 = 075;</div>
<div class = 'instructionText' > x3 = 275; &nbsp; y3 = 325;</div>
<div class = 'instructionText' > x4 = 075; &nbsp; y4 = 325;</div>
<div class = 'DayInputText' ><label class = 'dText' >X : </label><input value = '150' class = 'textField' type = 'text' id = 'textFieldXId' ></div>
<div class = 'DayInputText' ><label class = 'dText'>Y : </label><input value = '150' class = 'textField' type = 'text' id = 'textFieldYId' ></div>
<div class = 'instructionText marginTop' > x1 = 050; &nbsp; y1 = 050;</div>
<div class = 'instructionText' > x2 = 250; &nbsp; y2 = 050;</div>
<div class = 'instructionText' > x3 = 250; &nbsp; y3 = 300;</div>
<div class = 'instructionText' > x4 = 050; &nbsp; y4 = 300;</div>
<div class = 'DayInputText' ><label class = 'dText' >X : </label><input value = '050' class = 'textField' type = 'text' id = 'textFieldXId' ></div>
<div class = 'DayInputText' ><label class = 'dText'>Y : </label><input value = '050' class = 'textField' type = 'text' id = 'textFieldYId' ></div>
<div class = 'listDivision margin15' >
<select class = 'button expList' name = 'expression_input_list' id = 'loopList' >
<option>select code</option>
Expand Down Expand Up @@ -125,4 +125,4 @@
</div>
</div>
</body>
</html>
</html>
Loading