diff --git a/src/lab/exp1/simulation/numericalApproximation.js b/src/lab/exp1/simulation/numericalApproximation.js index 5ca76384..4879c65c 100644 --- a/src/lab/exp1/simulation/numericalApproximation.js +++ b/src/lab/exp1/simulation/numericalApproximation.js @@ -294,6 +294,11 @@ window.view = { alert('Integration Limits are from 0 to 30, b > a and b-a >= 1'); return false; } + else if(Number(valueA1)>10 || valueA2<1 || Number(valueB1)<1 ||valueB2>10){ + alert("invalid input"); + return false; + } + else { model.inputValueA = valueA2; model.inputValueB = valueB2; diff --git a/src/lab/exp10/simulation/index.htm b/src/lab/exp10/simulation/index.htm index 3e03797c..3242d532 100644 --- a/src/lab/exp10/simulation/index.htm +++ b/src/lab/exp10/simulation/index.htm @@ -38,6 +38,7 @@
-
4. Choose formula for area of the rectangle :
+
4. Choose formula for area of the rightangle triangle :
-
+
@@ -119,7 +119,7 @@
Step Execution
//function for square
-
//function for rectangle
+
//function for rightangle triangle
//function for triangle
//function for circle
diff --git a/src/lab/exp3/simulation/advControlFlow.js b/src/lab/exp3/simulation/advControlFlow.js index 9f83de25..152d96d4 100644 --- a/src/lab/exp3/simulation/advControlFlow.js +++ b/src/lab/exp3/simulation/advControlFlow.js @@ -34,11 +34,14 @@ window.view = { }, getInput: function() { var inputValue = document.getElementById('simpleLoopInput').value + if(Number(inputValue)>=20){alert("invalid input");} + else{ model.inp = Number(inputValue) - this.clearExecutionSection() + this.clearExecutionSection()} }, getNestedInput: function() { var inputValue = document.getElementById('nestedLoopInput').value + model.nestedInp = Number(inputValue) this.clearExecutionSection() }, @@ -377,4 +380,4 @@ window.view = { this.activateEvents() } } -window.onload = function() { view.init() } \ No newline at end of file +window.onload = function() { view.init() } diff --git a/src/lab/exp4/simulation/1-D/index.html b/src/lab/exp4/simulation/1-D/index.html index a6a25b17..43c1b7fd 100644 --- a/src/lab/exp4/simulation/1-D/index.html +++ b/src/lab/exp4/simulation/1-D/index.html @@ -21,8 +21,8 @@
-
- +
+
@@ -71,4 +71,4 @@ - \ No newline at end of file + diff --git a/src/lab/exp6/simulation/IfElse/basicControlFlow.js b/src/lab/exp6/simulation/IfElse/basicControlFlow.js index 44d45ecc..e8a611a7 100644 --- a/src/lab/exp6/simulation/IfElse/basicControlFlow.js +++ b/src/lab/exp6/simulation/IfElse/basicControlFlow.js @@ -233,9 +233,9 @@ window.view = { //this.getCanvas(); this.canvasContext.beginPath(); this.canvasContext.fillStyle = '#C2D995'; - this.canvasContext.fillRect (75, 75, 200, 250); + this.canvasContext.fillRect (50, 50, 200, 250); this.canvasContext.strokeStyle = '#000000'; - this.canvasContext.rect(75, 75, 200, 250); + this.canvasContext.rect(50, 50, 200, 250); this.canvasContext.stroke(); }, // drawCircle: draws circle on canvasContext according given x and y coordinates. @@ -262,10 +262,10 @@ window.view = { displayFigures: function () { this.drawDots(); this.drawFillRectangle(); - this.drawCircle(75, 75, '#000000'); - this.drawCircle(275, 75, '#000000'); - this.drawCircle(75, 325, '#000000'); - this.drawCircle(275, 325, '#000000'); + this.drawCircle(50, 50, '#000000'); + this.drawCircle(250, 50, '#000000'); + this.drawCircle(250, 300, '#000000'); + this.drawCircle(50, 300, '#000000'); this.displayText('(x1, y1)', 65, 65); this.displayText('(x2, y2)', 265, 65); this.displayText('(x3, y3)', 265, 345); @@ -355,7 +355,7 @@ window.view = { if (this.nextSiblingElement.id === 'codeContentIfElse4Id' || this.nextOfnextSiblingElement.id === 'codeContentIfElse6Id') { if (this.nextSiblingElement.id === 'codeContentIfElse4Id') this.codeExecutionWithColour(); - else if (model.valueOfX >= 75) + else if (model.valueOfX >= 50) this.changeFlagValue('flagValue1', 'codeContentIfElse6Id', '1'); else this.codeExecutionWithColourAndId('codeContentIfElse8Id'); @@ -363,7 +363,7 @@ window.view = { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse8Id' || this.nextOfnextSiblingElement.id === 'codeContentIfElse10Id') { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse8Id') this.codeExecutionWithColourAndId('codeContentIfElse8Id'); - else if (model.valueOfX <= 275) + else if (model.valueOfX <= 250) this.changeFlagValue('flagValue2', 'codeContentIfElse10Id', '1'); else this.codeExecutionWithColourAndId('codeContentIfElse12Id'); @@ -371,7 +371,7 @@ window.view = { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse12Id' || this.nextOfnextSiblingElement.id === 'codeContentIfElse14Id') { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse12Id') this.codeExecutionWithColourAndId('codeContentIfElse12Id'); - else if (model.valueOfY >= 75) + else if (model.valueOfY >= 50) this.changeFlagValue('flagValue3', 'codeContentIfElse14Id', '1'); else this.codeExecutionWithColourAndId('codeContentIfElse16Id'); @@ -379,7 +379,7 @@ window.view = { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse16Id' || this.nextOfnextSiblingElement.id === 'codeContentIfElse18Id') { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse16Id') this.codeExecutionWithColourAndId('codeContentIfElse16Id'); - else if (model.valueOfY <= 325) + else if (model.valueOfY <= 300) this.changeFlagValue('flagValue4', 'codeContentIfElse18Id', '1'); else this.codeExecutionWithColourAndId('codeContentIfElse20Id'); @@ -387,7 +387,7 @@ window.view = { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse20Id' || this.nextOfnextSiblingElement.id === 'codeContentIfElse22Id') { if (this.nextOfnextSiblingElement.id === 'codeContentIfElse20Id') this.codeExecutionWithColourAndId('codeContentIfElse20Id'); - else if (model.valueOfX > 75 && model.valueOfX < 275 && model.valueOfY > 75 && model.valueOfY < 325) { + else if (model.valueOfX > 50 && model.valueOfX < 250 && model.valueOfY > 50 && model.valueOfY < 300) { this.codeExecutionWithColourAndId('codeContentIfElse22Id'); this.displayTextWithColour('Output: INSIDE', 100, 40, '#FF2400'); } diff --git a/src/lab/exp6/simulation/IfElse/index.html b/src/lab/exp6/simulation/IfElse/index.html index 46080f90..474ccbaa 100644 --- a/src/lab/exp6/simulation/IfElse/index.html +++ b/src/lab/exp6/simulation/IfElse/index.html @@ -14,10 +14,10 @@
Initialize
-
x1 = 075;   y1 = 075;
-
x2 = 275;   y2 = 075;
-
x3 = 275;   y3 = 325;
-
x4 = 075;   y4 = 325;
+
x1 = 050;   y1 = 050;
+
x2 = 250;   y2 = 050;
+
x3 = 250;   y3 = 300;
+
x4 = 050;   y4 = 300;
@@ -125,4 +125,4 @@
- \ No newline at end of file + diff --git a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js index 6822a81c..a8aed54f 100644 --- a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js +++ b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js @@ -221,8 +221,8 @@ window.view = { this.codeExecutionWithColour(); if (this.currentSiblingElement.className === 'break redClass') this.codeExecutionWithColourAndId('closeBrc1Id'); - if (1 <= model.inputNumber && model.inputNumber <= 6) { - if (this.nextSiblingElement.id === 'holidayId') + if (1 <= model.inputNumber && model.inputNumber <= 5) { + if (this.nextSiblingElement.id === 'holidayId' ) this.codeExecutionWithColourAndId('elseIfId'); else if (this.nextSiblingElement.id === 'workingdayId') { this.codeExecutionWithColour(); @@ -230,9 +230,10 @@ window.view = { this.setInnerHtml('outputDayId', 'WORKING DAY'); } } - if ( model.inputNumber > 7 ) { + if ( model.inputNumber > 7 ||model.inputNumber <=0 ) { if (this.nextSiblingElement.id === 'holidayId') this.codeExecutionWithColourAndId('elseIfId'); + else if (this.nextSiblingElement.id === 'workingdayId') this.codeExecutionWithColourAndId('elseId'); else if (this.nextSiblingElement.id === 'invalidIPId') { @@ -240,7 +241,9 @@ window.view = { this.setInnerHtml('outputDayId', 'INVALID INPUT'); } } - if (model.inputNumber === 7) { + + + if (model.inputNumber === 7 || model.inputNumber === 6) { if (this.nextSiblingElement.id === 'holidayId') { this.codeExecutionWithColour(); this.changeOpacity('holidayImage'); diff --git a/src/lab/exp6/simulation/SwitchCase/index.html b/src/lab/exp6/simulation/SwitchCase/index.html index 4af5361f..0e337bc0 100644 --- a/src/lab/exp6/simulation/SwitchCase/index.html +++ b/src/lab/exp6/simulation/SwitchCase/index.html @@ -88,4 +88,4 @@
- \ No newline at end of file + diff --git a/src/lab/exp9/simulation/JS/recursion.js b/src/lab/exp9/simulation/JS/recursion.js index 1417a55b..0189feb6 100644 --- a/src/lab/exp9/simulation/JS/recursion.js +++ b/src/lab/exp9/simulation/JS/recursion.js @@ -23,8 +23,8 @@ window.view = { alert('Enter number of disks first !') else if ( isNaN(input) === true ) alert('Number of disks must be an integer value !') - else if ( input > 5 || input % 1 !== 0 ) - alert('Only integral value (Greater than equal to 1 and less than equal to 5) is accepted !') + else if ( input > 10 || input % 1 !== 0 ) + alert('invalid input') else { this.disableElement('btnOk') this.enableElement('btnStart') @@ -290,4 +290,4 @@ window.view = { this.activateEvents() } } -window.onload = function() { view.init() } \ No newline at end of file +window.onload = function() { view.init() }