diff --git a/src/lab/exp1/simulation/index.html b/src/lab/exp1/simulation/index.html index d6ceab13..dea2f9d0 100644 --- a/src/lab/exp1/simulation/index.html +++ b/src/lab/exp1/simulation/index.html @@ -24,7 +24,7 @@


1. Given a well-behaved smooth function, integrate it over the given limits of integration ?


2. Approximating solution to integral a smooth function.


-

3. Integration Limits are from 0 to 30, b > a and b-a >= 1.


+

3. Integration Limits are from 0 to 10, b > a and b-a >= 1.


diff --git a/src/lab/exp1/simulation/numericalApproximation.js b/src/lab/exp1/simulation/numericalApproximation.js index 5ca76384..24923f7c 100644 --- a/src/lab/exp1/simulation/numericalApproximation.js +++ b/src/lab/exp1/simulation/numericalApproximation.js @@ -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 >= valueB2 || valueB2 > 10) { + alert('Integration Limits are from 0 to 10, b > a and b-a >= 1'); return false; } else { diff --git a/src/lab/exp10/simulation/index.htm b/src/lab/exp10/simulation/index.htm index 3e03797c..3e9c2158 100644 --- a/src/lab/exp10/simulation/index.htm +++ b/src/lab/exp10/simulation/index.htm @@ -40,6 +40,7 @@ + @@ -77,4 +78,4 @@
- \ No newline at end of file + diff --git a/src/lab/exp2/simulation/function.js b/src/lab/exp2/simulation/function.js index 9d494050..11c2b728 100644 --- a/src/lab/exp2/simulation/function.js +++ b/src/lab/exp2/simulation/function.js @@ -178,13 +178,13 @@ 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 right angle triangle requires the length of the two adjacent sides other than hypotenuese. 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 right angle 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' ) - alert('Incorrect formula for calculating the area of a rectangle. Try again.') + alert('Incorrect datatype for return type. The value of the area of a right angle triangle need not be an integer. Try again.') + else if ( d !== '0.5*a*b' ) + alert('Incorrect formula for calculating the area of a right angle triangle. Try again.') else this.approveRectangleInputs() }, @@ -268,7 +268,7 @@ window.view = { document.getElementById('functionSquare').innerHTML += 'float area_sq (float a)
{
  float area = a*a;
  return area;
}' }, displayFunctionForRectangle: function() { - document.getElementById('functionRectangle').innerHTML += 'float area_rect (float a,float b)
{
  float area = a*b;
  return area;
}' + document.getElementById('functionRectangle').innerHTML += 'float area_rightangletri (float a,float b)
{
  float area = 0.5*a*b;
  return area;
}' }, displayFunctionForTriangle: function() { document.getElementById('functionTriangle').innerHTML += 'float area_triangle (float a)
{
 float area = (sqrt(3)/4.0)*a*a;
 return area;
}' @@ -318,8 +318,8 @@ window.view = { alert( 'area from function call ' + String( i + 1 ) + ' ) : ' + functionCall + ' is ' + this.area ) this.correctInputs ++ }, - area_rect: function( param, functionCall ) { - this.area = Number(param[0]) * Number(param[1]) + area_rightangletri: function( param, functionCall ) { + this.area = Number(0.5*param[0]) * Number(param[1]) this.totalArea += this.area alert( 'area from function call ' + String( i + 1 ) + ' ) : ' + functionCall + ' is ' + this.area ) this.correctInputs ++ @@ -367,7 +367,7 @@ window.view = { alert( 'Incorrect function call at line ' + String( i + 1 ) ) } else if ( parameter.length === 2 && functionCall === 'area_rect()' && isNaN(parameter[0]) === false && isNaN(parameter[1]) === false ) - this.area_rect(parameter, parsedValue) + this.area_rightangletri(parameter, parsedValue) else alert( 'Incorrect function call at line ' + String( i + 1 ) ) } diff --git a/src/lab/exp2/simulation/index.html b/src/lab/exp2/simulation/index.html index 5732a2ea..20cbe797 100644 --- a/src/lab/exp2/simulation/index.html +++ b/src/lab/exp2/simulation/index.html @@ -56,10 +56,10 @@
-
4. Choose formula for area of the rectangle :
+
4. Choose formula for area of the right angle triangle :
-
+
@@ -119,7 +119,7 @@
Step Execution
//function for square
-
//function for rectangle
+
//function for right angle triangle
//function for triangle
//function for circle
diff --git a/src/lab/exp2/simulation/rectangle.jpg b/src/lab/exp2/simulation/rectangle.jpg index 706279ed..ff6b97ad 100644 Binary files a/src/lab/exp2/simulation/rectangle.jpg and b/src/lab/exp2/simulation/rectangle.jpg differ diff --git a/src/lab/exp3/simulation/advControlFlow.js b/src/lab/exp3/simulation/advControlFlow.js index 9f83de25..1d6b7aab 100644 --- a/src/lab/exp3/simulation/advControlFlow.js +++ b/src/lab/exp3/simulation/advControlFlow.js @@ -35,11 +35,21 @@ window.view = { getInput: function() { var inputValue = document.getElementById('simpleLoopInput').value model.inp = Number(inputValue) + if(inputValue<0||inputValue>20) + { + alert('Invalid input!!The range of input is [0,20]'); + return false; + } this.clearExecutionSection() }, getNestedInput: function() { var inputValue = document.getElementById('nestedLoopInput').value model.nestedInp = Number(inputValue) + if(inputValue<0||inputValue>20) + { + alert('Invalid input!!The range of input is [0,20]'); + return false; + } this.clearExecutionSection() }, activateEvents: function() { @@ -377,4 +387,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..baa0a80e 100644 --- a/src/lab/exp4/simulation/1-D/index.html +++ b/src/lab/exp4/simulation/1-D/index.html @@ -20,7 +20,7 @@
-
+
@@ -65,10 +65,10 @@
-
0
+
0
Key Value
- \ 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..8e5be1c5 100644 --- a/src/lab/exp6/simulation/IfElse/basicControlFlow.js +++ b/src/lab/exp6/simulation/IfElse/basicControlFlow.js @@ -262,14 +262,14 @@ 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.displayText('(x1, y1)', 65, 65); - this.displayText('(x2, y2)', 265, 65); - this.displayText('(x3, y3)', 265, 345); - this.displayText('(x4, y4)', 75, 345); + this.drawCircle(50,50, '#000000'); + this.drawCircle(250,50, '#000000'); + this.drawCircle(250,300, '#000000'); + this.drawCircle(50,300, '#000000'); + this.displayText('(x1, y1)', 40,40); + this.displayText('(x2, y2)', 240,40); + this.displayText('(x3, y3)', 240,290); + this.displayText('(x4, y4)', 40,290); this.canvasContext.save(); }, /* validationInput: check validation of input that is given by user and if input value is valid @@ -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..84067beb 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/div> +
x4 = 050  y4 = 300/div>
@@ -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..e5f61028 100644 --- a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js +++ b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js @@ -221,7 +221,7 @@ window.view = { this.codeExecutionWithColour(); if (this.currentSiblingElement.className === 'break redClass') this.codeExecutionWithColourAndId('closeBrc1Id'); - if (1 <= model.inputNumber && model.inputNumber <= 6) { + if (1 <= model.inputNumber && model.inputNumber <= 5) { if (this.nextSiblingElement.id === 'holidayId') this.codeExecutionWithColourAndId('elseIfId'); else if (this.nextSiblingElement.id === 'workingdayId') { @@ -230,7 +230,7 @@ window.view = { this.setInnerHtml('outputDayId', 'WORKING DAY'); } } - if ( model.inputNumber > 7 ) { + if ( model.inputNumber <=0 || model.inputNumber >7 ) { if (this.nextSiblingElement.id === 'holidayId') this.codeExecutionWithColourAndId('elseIfId'); else if (this.nextSiblingElement.id === 'workingdayId') @@ -240,7 +240,7 @@ window.view = { this.setInnerHtml('outputDayId', 'INVALID INPUT'); } } - if (model.inputNumber === 7) { + if (model.inputNumber === 6 || model.inputNumber === 7) { 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..d19eac98 100644 --- a/src/lab/exp6/simulation/SwitchCase/index.html +++ b/src/lab/exp6/simulation/SwitchCase/index.html @@ -54,7 +54,7 @@
  default : str = null;
   break;
 }
-
 if ( strcmp( str, 'Sunday' ) == 0 ) {
+
 if ( strcmp( str, 'Saturday' ) == 0 || strcmp( str, 'Sunday') == 0 ) {
  printf ( 'HOLIDAY' ); }
 else if ( str != null ) {
  printf ( 'WORKING DAY' ); }
@@ -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..ac63f467 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('Only integral value (Greater than equal to 1 and less than equal to 10) is accepted !') 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() }