Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, b > a and b-a >= 1.</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 >= valueB2 || valueB2 > 10) {
alert('Integration Limits are from 0 to 10, b > a and b-a >= 1');
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 @@ -40,6 +40,7 @@
<option> a + b - c </option>
<option> a + b / c </option>
<option> ( a + b ) / c </option>
<option> a * ( b + c ) </option>
<option> ( a + b ) * c - d </option>
<option> ( a + b ) * ( c - d ) </option>
<option> a * d % ( c - b ) * c - a * b </option>
Expand Down Expand Up @@ -77,4 +78,4 @@
</div><!-- end of resultDisplay -->
</div><!-- end of outputDivision -->
</body>
</html>
</html>
18 changes: 9 additions & 9 deletions src/lab/exp2/simulation/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
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_rightangletri (float a,float b)<br>{<br> &emsp; float area = 0.5*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 @@ -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 ++
Expand Down Expand Up @@ -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 ) )
}
Expand Down
6 changes: 3 additions & 3 deletions src/lab/exp2/simulation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group7" value="int"><label class="radioText">int</label></div>
<div class="radioButtonHolder"><input type="radio" class="radiobutton" name="radio_group7" value="float"><label class="radioText">float</label></div><!-- end of 3rd question -->

<div class="questionTextRich">4. Choose formula for area of the rectangle :</div>
<div class="questionTextRich">4. Choose formula for area of the right angle triangle :</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="0.5*a*b"><label class="radioText">0.5*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 right angle triangle</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
Binary file modified src/lab/exp2/simulation/rectangle.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/lab/exp3/simulation/advControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -377,4 +387,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/1-D/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<button class = 'button okButton' id = 'btnOk' >OK</button>
</div><!-- end of arraySizeInputBlock -->
<div class = 'radioButtonDivision hide' id = 'inputButtonRadio' >
<div class = 'randomRadioButtonDivision' ><input type = 'radio' class = 'radiobutton' name = 'radio_group' id = 'btnRandom' ><label class = 'radioText' for = 'male' >Generate Random Values</label></div><!-- end of randomRadioButtonDivision -->
<div class = 'randomRadioButtonDivision' ><input type = 'radio' class = 'radiobutton' name = 'radio_group' id = 'btnRandom' onclick="document.getElementById('userInput').disabled=true;"><label class = 'radioText' for = 'male' >Generate Random Values</label></div><!-- end of randomRadioButtonDivision -->
<div class = 'enterValueRadioButtonDivision' ><input type = 'radio' class = 'radiobutton' name = 'radio_group' id = 'btnManual'><label class = 'radioText' for = 'male' >Enter Values Manually</label></div><!-- end of enterValueRadioButtonDivision -->
<textarea class = 'arrayInputArea' name = 'firstname' placeholder = 'Enter values here in comma seperated format or seperated with space' id = 'userInput' ></textarea>
<div class = 'buttonHolder' ><button class = 'buttonDisable startButton' id = 'btnStart' disabled>Start</button><button class = 'buttonDisable nextButton' id = 'btnNext' disabled>Next</button></div><!-- end of buttonHolder -->
Expand Down Expand Up @@ -65,10 +65,10 @@
</div><!-- end of KeyPointerDisplayDivision -->
<div class = 'sortingDivision' id = 'sortingDiv' ></div>
<div class = 'currentKeyPositionIndicator' >
<div class = 'currentKeyValue' id = 'key'>0</div>
<div class = 'currentKeyValue' id = 'key'>0<br><img src="arrowSmall.png" height="20px"width="50px"></div>
<div class = 'textKeyValue' >Key Value</div>
</div><!-- end of currentKeyPositionIndicator -->
</div><!-- end of resultDisplay -->
</div><!-- end of outputDivision -->
</body>
</html>
</html>
26 changes: 13 additions & 13 deletions src/lab/exp6/simulation/IfElse/basicControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -355,39 +355,39 @@ 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');
}
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');
}
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');
}
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');
}
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');
}
Expand Down
10 changes: 5 additions & 5 deletions src/lab/exp6/simulation/IfElse/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<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 = '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 = '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 = 'listDivision margin15' >
Expand Down Expand Up @@ -125,4 +125,4 @@
</div>
</div>
</body>
</html>
</html>
6 changes: 3 additions & 3 deletions src/lab/exp6/simulation/SwitchCase/basicControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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')
Expand All @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/lab/exp6/simulation/SwitchCase/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div id = 'defaultId' >&emsp;&emsp;default : str = null;</div>
<div id = 'defaultBreakId' class='break' >&emsp;&emsp;&emsp;break; </div>
<div id = 'closeBrc1Id' >&emsp;}</div>
<div id = 'ifId' >&emsp;if ( strcmp( str, 'Sunday' ) == 0 ) {</div>
<div id = 'ifId' >&emsp;if ( strcmp( str, 'Saturday' ) == 0 || strcmp( str, 'Sunday') == 0 ) {</div>
<div id = 'holidayId' >&emsp;&emsp;printf ( 'HOLIDAY' ); }</div>
<div id = 'elseIfId' >&emsp;else if ( str != null ) {</div>
<div id = 'workingdayId' >&emsp;&emsp;printf ( 'WORKING DAY' ); }</div>
Expand Down Expand Up @@ -88,4 +88,4 @@
</div>
</div>
</body>
</html>
</html>
6 changes: 3 additions & 3 deletions src/lab/exp9/simulation/JS/recursion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -290,4 +290,4 @@ window.view = {
this.activateEvents()
}
}
window.onload = function() { view.init() }
window.onload = function() { view.init() }