diff --git a/src/lab/bstyle.css b/src/lab/bstyle.css index f289b42a..97272685 100644 --- a/src/lab/bstyle.css +++ b/src/lab/bstyle.css @@ -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) { diff --git a/src/lab/exp1/simulation/numericalApproximation.js b/src/lab/exp1/simulation/numericalApproximation.js index 5ca76384..25742c21 100644 --- a/src/lab/exp1/simulation/numericalApproximation.js +++ b/src/lab/exp1/simulation/numericalApproximation.js @@ -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; diff --git a/src/lab/exp2/simulation/function.js b/src/lab/exp2/simulation/function.js index 9d494050..64de5223 100644 --- a/src/lab/exp2/simulation/function.js +++ b/src/lab/exp2/simulation/function.js @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js index 6822a81c..a6112226 100644 --- a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js +++ b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js @@ -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. @@ -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; @@ -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 () { diff --git a/src/lab/exp7/simulation/StringMatching/stringMatching.js b/src/lab/exp7/simulation/StringMatching/stringMatching.js index 12fc1195..831ffae2 100644 --- a/src/lab/exp7/simulation/StringMatching/stringMatching.js +++ b/src/lab/exp7/simulation/StringMatching/stringMatching.js @@ -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(); diff --git a/src/lab/exp9/quiz.html b/src/lab/exp9/quiz.html index c66878ee..f7334caf 100644 --- a/src/lab/exp9/quiz.html +++ b/src/lab/exp9/quiz.html @@ -20,7 +20,14 @@ body{ background-color: #f4f4f4; } - + +
@@ -68,14 +75,14 @@ printf(" * "); } -a. n
@@ -88,10 +95,10 @@
printf("%d ", n);
}
-a. 20 40 60 80 60 40 20
@@ -103,10 +110,10 @@
return 1 + fun1(n/2);
}
-a. 6
@@ -118,10 +125,10 @@
return fun1(x - 1, x + y);
}
-a. 13