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
1 change: 0 additions & 1 deletion src/lab/bstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ border-color: #e7e7e7;

.navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>li>a{ /*.navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus {*/
color: #fff;
background: #3652a4;
}

@media (max-width: 480px) {
Expand Down
4 changes: 4 additions & 0 deletions src/lab/exp1/simulation/numericalApproximation.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ window.view = {
alert('Integration Limits are from 0 to 30, b > a and b-a >= 1');
return false;
}
else if (valueA2 < 0 || valueB2 < 0 ){
alert('Integration Limits are from 0 to 30, b > a and b-a >=1');
return false;
}
else {
model.inputValueA = valueA2;
model.inputValueB = valueB2;
Expand Down
24 changes: 8 additions & 16 deletions src/lab/exp2/simulation/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ window.view = {
}
if ( a !== '1')
alert('Incorrect value of input variables(arguments). Calculating the area of a square only requires the length of the side of the square. Try again.')
else if ( b !== 'float' )
alert('Incorrect datatype of input variables(arguments). The value of the side of a square need not be an integer. Try again.')
else if ( c !== 'float' )
alert('Incorrect datatype for return type. The value of the area of a square need not be an integer. Try again.')
else if( b != 'int' && c == 'int')
alert('Incorrect data types');
else if ( d !== 'a*a' )
alert('Incorrect formula for calculating the area of a square. Try again.')
else
Expand Down Expand Up @@ -179,10 +177,8 @@ window.view = {
}
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.')
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.')
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( b != 'int' && c == 'int')
alert('Incorrect data types');
else if ( d !== 'a*b' )
alert('Incorrect formula for calculating the area of a rectangle. Try again.')
else
Expand Down Expand Up @@ -217,10 +213,8 @@ window.view = {
}
if ( a !== '1')
alert('Incorrect value of input variables(arguments). Calculating the area of an equilateral triangle only requires the length of one of the sides of the triangle. Try again.')
else if ( b !== 'float' )
alert('Incorrect datatype of input variables(arguments). The value of the side of an equilateral triangle need not be an integer. Try again.')
else if ( c !== 'float' )
alert('Incorrect datatype for return type. The value of the area of an equilateral triangle need not be an integer. Try again.')
else if( b != 'int' && c == 'int')
alert('Incorrect data types');
else if ( d !== 'correct' )
alert('Incorrect formula for calculating the area of an equilateral triangle. Try again.')
else
Expand Down Expand Up @@ -255,10 +249,8 @@ window.view = {
}
if ( a !== '1')
alert('Incorrect value of input variables(arguments). Calculating the area of circle only requires the radius. Try again.')
else if ( b !== 'float' )
alert('Incorrect datatype of input variables(arguments). The value of the radius of the circle need not be an integer. Try again.')
else if ( c !== 'float' )
alert('Incorrect datatype for return type. The value of the area of the circle need not be an integer. Try again.')
else if( b != 'int' && c == 'int')
alert('Incorrect data types');
else if ( d !== 'pi*a*a' )
alert('Incorrect formula for calculating the area of the circle. Try again.')
else
Expand Down
28 changes: 23 additions & 5 deletions src/lab/exp6/simulation/SwitchCase/basicControlFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
window.model = {
inputNumber: 0, //user input text field.
}

var x;
window.view = {
currentSiblingElement: new Object(), // Object value of current sibling.
nextSiblingElement: new Object(), // Object value of next sibling.
Expand All @@ -24,11 +24,21 @@ window.view = {
this.addClickEvent('radioBtn5Id', function() { view.setValue('textFieldId', this.value) });
this.addClickEvent('radioBtn6Id', function() { view.setValue('textFieldId', this.value) });
this.addClickEvent('radioBtn7Id', function() { view.setValue('textFieldId', this.value) });
this.addClickEvent('radioBtn1Id', function() { view.setValu('radioBtn1Id') });
this.addClickEvent('radioBtn2Id', function() { view.setValu('radioBtn2Id') });
this.addClickEvent('radioBtn3Id', function() { view.setValu('radioBtn3Id') });
this.addClickEvent('radioBtn4Id', function() { view.setValu('radioBtn4Id') });
this.addClickEvent('radioBtn5Id', function() { view.setValu('radioBtn5Id') });
this.addClickEvent('radioBtn6Id', function() { view.setValu('radioBtn6Id') });
this.addClickEvent('radioBtn7Id', function() { view.setValu('radioBtn7Id') });
this.addClickEvent('submitBtnId', function() { view.validationInput() });
this.addClickEvent('startBtnId', function() { view.startStepExecution() });
this.addClickEvent('nextBtnId', function() { view.showDayOfWeek() });
this.addClickEvent('resetBtnId', function() { view.resetButtonSwitch() });
},
setValu: function (id){
x=document.getElementById(id).value;
},
// setInnerHtml: set innerText to a element.
setInnerHtml: function (id, innerHTML) {
document.getElementById(id).innerHTML = innerHTML;
Expand Down Expand Up @@ -131,15 +141,23 @@ window.view = {
then make submit button disable and make start button enable. */
validationInput: function () {
var textFieldValue = this.getValue('textFieldId');
if (textFieldValue === '' || isNaN(textFieldValue)) {
alert('Enter Numeric Values Only');
if (textFieldValue === '' || isNaN(textFieldValue)){
alert('Enter Numeric Values Only');
return false;
}
else if( textFieldValue != x){
alert("enter the value same in the text box as the option selected in the radio buttons");
return false;
}
}
else if(Number(textFieldValue) <= 0 || Number(textFieldValue) > 7){
alert("Enter the numbers in the interval [1,7]");
return false;
}
else {
this.changePropertyOfElements();
model.inputNumber = Number(textFieldValue);
this.setInnerHtml('idOfDay', model.inputNumber);
}
}
},
// changePropertyOfElements: changes property of elemants with enableElement, disableElement and changeClass.
changePropertyOfElements: function () {
Expand Down
27 changes: 27 additions & 0 deletions src/lab/exp7/simulation/StringMatching/stringMatching.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ window.view = {
alert('Maximum String Size allowed is Seven, Minimum Size is One and size of str2 should be less than equal to size of str1');
return false;
}
else{
var i=0;
var j=0;
var k=0;
for(i=0 ; i < model.inputString1.length ; i++){
if( model.inputString1[i] == ' '){
j=1;
}
}
for(i=0; i < model.inputString2.length ; i++){
if(model.inputString2[i]== ' '){
k=1;
}
}
if(j==1 && k==1){
alert("Input the strings with no spaces in it");
return false;
}
else if(j==1 && k==0){
alert("Input the string str1 with no spaces in it");
return false;
}
else if(j==0 && k==1){
alert("Input the string str2 with no spaces in it");
return false;
}
}
this.changePropertyOfElements();
this.resetStrings();
this.resetTable();
Expand Down
45 changes: 26 additions & 19 deletions src/lab/exp9/quiz.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
body{
background-color: #f4f4f4;
}
</style>
</style>
<script>
function myFunction(id){
id+="1";
var x=document.getElementById(id);
x.checked=true;
}
</script>
</head>
<body>

Expand Down Expand Up @@ -68,14 +75,14 @@
printf(" * ");
}
</pre>
<input name="Q1" type="radio" value="1">a. n<br>
<input name="Q1" type="radio" value="2">b. n^2<br>
<input name="Q1" type="radio" value="3">c. n(n-1)/2<br>
<input name="Q1" type="radio" value="4">d. n(n+1)/2<br>
<input name="Q1" type="radio" value="1" id="Q1a1"><span onclick="myFunction(id)" id="Q1a">a. n</span><br>
<input name="Q1" type="radio" value="2" id="Q1b1"><span onclick="myFunction(id)" id="Q1b" >b. n^2</span><br>
<input name="Q1" type="radio" value="3" id="Q1c1"><span onclick="myFunction(id)" id="Q1c">c. n(n-1)/2</span><br>
<input name="Q1" type="radio" value="4" id="Q1d1"><span onclick="myFunction(id)" id="Q1d">d. n(n+1)/2</span>><br>
<br>
<li><b>For every recursive solution, there is a corresponding iterative solution</b></li>
<input name="Q2" type="radio" value="1">a. True<br>
<input name="Q2" type="radio" value="2">b. False<br>
<input name="Q2" type="radio" value="1" id="Q2a1"><span onclick="myFunction(id)" id="Q2a">a. True</span><br>
<input name="Q2" type="radio" value="2" id="Q2b1"><span onclick="myFunction(id)" id="Q2b">b. False</span><br>
<br>
<li><b>What will be the ouptut of the following function call: fun2(20); where fun2 is defined as: </b> </li>
<pre class="prettyprint lang-c">
Expand All @@ -88,10 +95,10 @@
printf("%d ", n);
}
</pre>
<input name="Q3" type="radio" value="1">a. 20 40 60 80 60 40 20<br>
<input name="Q3" type="radio" value="2">b. 80 60 40 20<br>
<input name="Q3" type="radio" value="3">c. 20 40 60 80 80 60 40 20<br>
<input name="Q3" type="radio" value="4">d. 20 40 60 80<br>
<input name="Q3" type="radio" value="1" id="Q3a1"><span onclick="myFunction(id)" id="Q3a">a. 20 40 60 80 60 40 20</span><br>
<input name="Q3" type="radio" value="2" id="Q3b1"><span onclick="myFunction(id)" id="Q3b">b. 80 60 40 20</span><br>
<input name="Q3" type="radio" value="3" id="Q3c1"><span onclick="myFunction(id)" id="Q3c">c. 20 40 60 80 80 60 40 20</span><br>
<input name="Q3" type="radio" value="4" id="Q3d1"><span onclick="myFunction(id)" id="Q3d">d. 20 40 60 80</span><br>
<br>
<li><b>What will be the ouptut of the following function call: fun3(100); where fun3 is defined as: </b> </li>
<pre class="prettyprint lang-c">
Expand All @@ -103,10 +110,10 @@
return 1 + fun1(n/2);
}
</pre>
<input name="Q4" type="radio" value="1">a. 6<br>
<input name="Q4" type="radio" value="2">b. 7<br>
<input name="Q4" type="radio" value="3">c. 5<br>
<input name="Q4" type="radio" value="4">d. 4<br>
<input name="Q4" type="radio" value="1" id="Q4a1"><span onclick="myFunction(id)" id="Q4a">a. 6</span><br>
<input name="Q4" type="radio" value="2" id="Q4b1"><span onclick="myFunction(id)" id="Q4b">b. 7</span><br>
<input name="Q4" type="radio" value="3" id="Q4c1"><span onclick="myFunction(id)" id="Q4c">c. 5</span><br>
<input name="Q4" type="radio" value="4" id="Q4d1"><span onclick="myFunction(id)" id="Q4d">d. 4</span><br>
<br>
<li><b>What will be the ouptut of the following function call: fun4(4,3); where fun4 is defined as: </b> </li>
<pre class="prettyprint lang-c">
Expand All @@ -118,10 +125,10 @@
return fun1(x - 1, x + y);
}
</pre>
<input name="Q5" type="radio" value="1">a. 13<br>
<input name="Q5" type="radio" value="2">b. 14<br>
<input name="Q5" type="radio" value="3">c. 3<br>
<input name="Q5" type="radio" value="4">d. 7<br>
<input name="Q5" type="radio" value="1" id="Q5a1"><span onclick="myFunction(id)" id="Q5a">a. 13</span><br>
<input name="Q5" type="radio" value="2" id="Q5b1"><span onclick="myFunction(id)" id="Q5b">b. 14</span><br>
<input name="Q5" type="radio" value="3" id="Q5c1"><span onclick="myFunction(id)" id="Q5c">c. 3</span><br>
<input name="Q5" type="radio" value="4" id="Q5d1"><span onclick="myFunction(id)" id="Q5d">d. 7</span><br>
<br>
<li><b>A recursive function must necessarily make a call to </b> <input name="fib1" type="text"/> </li>
<li><b>A <input name="fib2" type="text"/> is required so that there is no infinite recursive calling of the same function.</b></li><br><br/>
Expand Down