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
5 changes: 5 additions & 0 deletions src/lab/exp1/simulation/numericalApproximation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 @@ -38,6 +38,7 @@
<button class = 'button editButton' id = 'buttonEdit' >Edit</button>
<select class = 'button loopList' id = 'arithmaticExpressions' >
<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>
Expand Down Expand Up @@ -77,4 +78,4 @@
</div><!-- end of resultDisplay -->
</div><!-- end of outputDivision -->
</body>
</html>
</html>
14 changes: 7 additions & 7 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 rectangle requires the length of adj side and opposite side.')
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' )
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 triangle need not be an integer. Try again.')
else if ( d !== '0.5*a*b' )
alert('Incorrect formula for calculating the area of a 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_rect (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 @@ -383,4 +383,4 @@ window.view = {
}
}

window.onload = function() { view.init() }
window.onload = function() { view.init() }
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,9 +56,9 @@
<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 rightangle 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="a*b"><label class="radioText">0.5*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 -->

<button class="button okButton" id = 'okRectangle'>OK</button>
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 rightangle 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
7 changes: 5 additions & 2 deletions src/lab/exp3/simulation/advControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand Down Expand Up @@ -377,4 +380,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 @@ -21,8 +21,8 @@
</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 = '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 = 'enterValueRadioButtonDivision' ><input type = 'radio' class = 'radiobutton' name = 'radio_group' id = 'btnManual'><label class = 'radioText' for = 'male' >Enter Values Manually</label><!-- end of enterValueRadioButtonDivision -->
<textarea class = 'arrayInputArea' name = 'firstname' placeholder = 'Enter values here in comma seperated format or seperated with space' id = 'userInput' ></textarea></div>
<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 -->
</div><!-- end of radioButtonDivision -->
</div><!-- end of inputDivisionBody -->
Expand Down Expand Up @@ -71,4 +71,4 @@
</div><!-- end of resultDisplay -->
</div><!-- end of outputDivision -->
</body>
</html>
</html>
22 changes: 11 additions & 11 deletions src/lab/exp6/simulation/IfElse/basicControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
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>
11 changes: 7 additions & 4 deletions src/lab/exp6/simulation/SwitchCase/basicControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,26 +221,29 @@ 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();
this.changeOpacity('workingdayImage');
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') {
this.codeExecutionWithColour();
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');
Expand Down
2 changes: 1 addition & 1 deletion src/lab/exp6/simulation/SwitchCase/index.html
Original file line number Diff line number Diff line change
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('invalid input')
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() }