[Go to site: main page, start]

0% found this document useful (0 votes)
7 views11 pages

Scripting Languages Practical Certificate

The document is a certificate of completion for a student at M. D. Palesha Commerce College, confirming the successful completion of 12 practicals in Scripting Languages for the academic year 2024-2025. It includes an index of practicals covering various JavaScript and Python programming tasks, such as validating input and calculating factorials. The certificate is signed by the subject teacher and the head of the department.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views11 pages

Scripting Languages Practical Certificate

The document is a certificate of completion for a student at M. D. Palesha Commerce College, confirming the successful completion of 12 practicals in Scripting Languages for the academic year 2024-2025. It includes an index of practicals covering various JavaScript and Python programming tasks, such as validating input and calculating factorials. The certificate is signed by the subject teacher and the head of the department.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Dhule Education Society’s

M. D. Palesha Commerce College, Dhule


Department of Computer
Certificate of Completion

Date: 24 Oct 2024

This is to certify that _____________________________________________________


Student of T.Y.B.M.S. (e-Commerce) Semester – V, has satisfactorily
completed 12 practical’s in the Subject E 5.7 Practical on Scripting
Lanaguages as laid down by the North Maharashtra University, Jalgaon for
the academic Year 2024-2025.

H. P. Jain
(Subject Teacher) HOD / Principal

Internal Examiner External Examiner


Dhule Education Society’s

M. D. Palesha Commerce College, Dhule

Scripting Language Index

Sr. Title Date Sign


No.

1. Study of Popup Boxes in Java script.

2. Java script to print Odd and Even numbers in given range.

3. Java script to print Factorial of a given number.

4. Java script to print 15 terms of Fibonacci Series

5. Java script to demonstrate use of procedure and functions

6. Demonstration of Exception Handling using Java script.

7. Java script to validate a Number.

8. Java script to validate NOT NULL data / value.

9. Java script to validate E-Mail address.

10. Python program to print number is Positive or Negative

11. Python program to print first n numbers

12. Python program to print factorial of a given numbers


<!-- JavaScript code to demonstrate the use of various dialog boxes -->

<HTML>
<HEAD>
<TITLE>
Popup Boxes
</TITLE>

<SCRIPT LANGUAGE="JAVASCRIPT">
function display()
{
var n
n = prompt( "Enter the Number", "Text" );

if ( isNaN( n ) )
{
confirm( "Invalid Number" );
}
else
{
alert( "Given number is " + n );
}
}
</SCRIPT>
</HEAD>

<BODY>
<FORM NAME="frm">
<INPUT TYPE=submit VALUE="Submit" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to print Odd and Even numbers in given range -->
<HTML>
<HEAD>
<TITLE>
Odd and Even in Range
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function even()
{
var n, n1, i;
n = parseInt( [Link]( "t1" ).value );
n1 = parseInt( [Link]( "t2" ).value );
[Link]( "<h1>Even numbers between " + n + " and " + n1 + " are</h1>");
i = n;
while( i <= n1 )
{
if (i%2 == 0 )
[Link]( i + "<br>" );
i++;
}

[Link]( "<h1>Odd numbers between " + n + " and " + n1 + " are</h1>");
i = n;
while( i <= n1 )
{
if (i%2 != 0 )
[Link]( i + "<br>" );
i++;
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frm">
Enter Starting Number
<INPUT TYPE=text ID="t1"> <br>
Enter End Number
<INPUT TYPE=text ID="t2"> <p>
<INPUT TYPE=button VALUE="Display Numbers" ID="b1" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to print factorial of a given number -->
<HTML>
<HEAD>
<TITLE>
Factorial of Number
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function factorial()
{
var n, i, fact;

n = parseInt( [Link]( "t1" ).value );

for (i = 1, fact = 1; i <= n; i++ )


{
fact = fact * i;
}

[Link]( "<h1>Factorial of " + n + " is " + fact + "</h1>");


}
</SCRIPT>
</HEAD>

<BODY>
<FORM NAME="frm">
Enter Number for Factorial
<INPUT TYPE=text ID="t1"> <p>
<INPUT TYPE=button VALUE="Display" ID="b1" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to demonstrate the use of exception handling -->
<HTML>
<HEAD>
<TITLE>
Exception Handling
</TITLE>

<SCRIPT LANGUAGE=“JavaScript”>
function division()
{
var a, b, c;

try
{
a = [Link]( "t1" ).value ;
b = [Link]( "t2" ).value ;

if ( isNaN( a ) || isNaN( b ) )
throw "Invalid Number(s)";

if ( b == 0 )
throw "Divide by ZERO error";

c = a / b;

[Link]( "<h1>Division of " + a + " by " + b + " is " +c );


}
catch( e )
{
[Link]( "<h1>Error is " + e );
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frm">
Enter First Number
<INPUT TYPE=text ID="t1">
<p>
Enter Second Number
<INPUT TYPE=text ID="t2">
<p>
<INPUT TYPE=button ID="b1" VALUE="Display" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to demonstrate the use of null validation-->
<HTML>
<HEAD>
<TITLE>
NULL Validation
</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function nullvalidate()
{
var n;
try
{
n = [Link]( "t1" ).value ;
if ( n == null || n == "" )
throw "Null Value";
[Link]( "<h1>Given Data is " + n );
}
catch( e )
{
[Link]( "<h1>Error is " + e );
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frm">
Enter the Data
<INPUT TYPE=text id="t1">
<p>
<INPUT TYPE=button ID="b1" VALUE="Display" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to demonstrate the use of number validation-->
<HTML>
<HEAD>
<TITLE>
Number Validation
</TITLE>

<SCRIPT LANGUAGE=“JavaScript”>
function numvalidate()
{
var n;
try
{
n = [Link]( "t1" ).value ;
if ( n == null || n == "" )
throw "Not a Number";
if ( isNaN( n ) )
throw "Invalid Number";
[Link]( "<h1>Given number is " + n );
}
catch( e )
{
[Link]( "<h1>Error is " + e );
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frm">
Enter the Number
<INPUT TYPE=text id="t1">
<p>
<INPUT TYPE=button ID="b1" VALUE="Display" > </FORM>
</BODY>
</HTML>
<!-- JavaScript code to demonstrate the use of email validation-->
<HTML>
<HEAD>
<TITLE>
email Address Validation
</TITLE>
<SCRIPT LANGUAGE=“JavaScript”>
function emailvalidate()
{
var emailaddress;
try
{
emailaddress = [Link]( "t1" ).value ;
if ( emailaddress == null || emailaddress == "" )
throw "No email address";
atposition = [Link]( "@" );
dotposition = [Link]( "." );
if ( atposition < 1 || (dotposition-atposition) < 2 )
throw "Invalid email address";
[Link]( "<h1>Given email address is " + emailaddress );
}
catch( e )
{
[Link]( "<h1>Error is : " + e );
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frm">
Enter email Address
<INPUT TYPE=text ID="t1">
<P>
<INPUT TYPE=button ID="b1" VALUE="Display" > </FORM>
</BODY>
</HTML>
#Python program to print whether number is positive or negative

n = int(input("Enter any number"))


if n >= 0:
print(n, " is POSITIVE")
else:
print(n, " is NEGATIVE")

#Python program to print first n numbers

n = int(input("Enter How many number"))


i=1
print( "First ", n, "numbers are")
while i <= n:
print( i )
i=i+1

#Python program to print factorial of a given number


n = int(input("Enter Number for Factorial"))
i=1
fact = 1
while i <= n:
fact = fact * i
i=i+1
print( "Factorial of " , n, " is ", fact)

Common questions

Powered by AI

The Python example for factorial utilizes a while loop for iteration, whereas the JavaScript version employs a for loop. This difference highlights the flexibility of programming concepts, illustrating how similar logical constructs can be expressed differently across languages. Despite syntactic differences, the core logic of iterating to multiply successive integers remains constant, demonstrating universal programming principles .

The factorial example illustrates iterative processes by using a loop to repeatedly multiply the accumulating product by each successive integer up to the input number. This showcases how iteration can be used to perform repetitive calculations and build a result incrementally, emphasizing the utility of loops for handling iterative tasks .

Functions and procedures in JavaScript serve to encapsulate blocks of code that perform specific tasks, making code easier to manage, debug, and reuse. They help in organizing code into logical segments, allowing developers to follow a modular programming approach that enhances maintainability and reduces complexity .

Input validation for numeric fields is implemented using JavaScript by checking if the input is actually a numeric value and not null or an empty string. If the input fails these checks, exceptions are thrown with specific error messages to alert the user. This is crucial to prevent runtime errors and ensure that the input is processed correctly by subsequent operations .

Null value checks are handled by checking if a field is null or an empty string, throwing a 'Null Value' exception when invalid input is encountered. This ensures that the program does not proceed with missing or undefined data, which is crucial for maintaining data integrity and preventing errors in operations that depend on valid input .

Executing practical scripting language tasks provides hands-on experience that helps students understand theoretical concepts through real-world application. It bridges the gap between theory and practice, thus deepening their comprehension of how scripting languages function within e-Commerce platforms, enhancing problem-solving skills, and preparing them for practical challenges in their future careers .

The main components of validating an email address in JavaScript involve checking for the presence of the '@' symbol and '.' symbol in the correct positions. Programmatically, this is achieved by checking that the '@' symbol is present and that there is at least two characters between the '@' and the last '.' in the email string. If these conditions do not hold, an error is thrown indicating an 'Invalid email address' .

Validating input before performing operations such as division prevents potential errors like 'Divide by ZERO' and ensures only valid numbers are processed. This is vital in web-based applications to maintain reliability and user trust by preventing crashes or erroneous results, ensuring the application behaves predictably and securely under various input scenarios .

Exception handling in JavaScript, as demonstrated by the division function, allows the program to continue operating even when exceptions occur, rather than terminating. It helps in identifying input errors such as 'Invalid Number(s)' or 'Divide by ZERO error', providing meaningful error messages to the user and maintaining the stability and integrity of the application .

Looping constructs facilitate the execution of repetitive tasks by iterating over a range of numbers, checking conditions (whether a number is odd or even), and printing results for each cycle. The example shows how loops can be effectively used to minimize code redundancy and automate repetitive calculations, improving efficiency and maintainability of the code .

You might also like