We b Programming (22UIS503C) 1 Department of Information Science and Engineering Assignment No. - 1 Develop and demonstrate a XHTML document that illustrate the use of, ordered list, unordered nested list, table, borders, padding, color and the <span> tag. <!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>List and Table Example</title> <style> table { border: 2px solid black; border - collapse: collapse; } th, td { border: 1px solid black; padding: 10px; } .highlight { color: red; font - weight: bold; } </style> </head> <body> <h2>Ordered List Example</h2> <ol> <li>Programming</li> <li>Web Development</li> <li>Database Systems</li> </ol> Web Programming (22UIS503C) 2 Department of Information Science and Engineering <h2>Unordered Nested List Example</h2> <ul> <li>Programming Languages <ul> <li>C</li> <li>Java</li> <li>Python</li> </ul> </li> <li>Web Technologies <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </li> </ul> <h2>Table with Borders, Padding, Colors & Span</h2> <table> <tr> <th>Name</th> <th>Marks</th> </tr> <tr> <td>John</td> <td><span class="highlight">89</span></td> </tr> <tr> <td>Sam</td> <td><span class="highlight">95</span></td> </tr> </table> </body> </html> We b Programming (22UIS503C) 3 Department of Information Science and Engineering Output: Web Programming (22UIS503C) 4 Department of Information Science and Engineering Assignment No. - 2 Design an XHTML web page using CSS, which has two paragraphs as follows: i. First para - Arial font, 24 pt size, italic, bold, text color blue, background color yellow, underlined, aligned right ii. Second para Courier font, 40pt size, small capital letters, overlined, background color white, text color red, aligned center. <?xml version="1.0" encoding="UTF - 8"?> <!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> .para1{ font - family:arial; font - size:24pt; font - weight:bold; font - style:italic; color:blue; background - color: yellow; text - decoration: underline; text - align:right; } .para2{ font - family:courier; font - size:40pt; font - variant: small - caps; text - decoration: overline; background - color: white; color:red; text - align:center; We b Programming (22UIS503C) 5 Department of Information Science and Engineering } </style> </head> <body> <p class="para1"> This is paragraph one. Lorem ipsum dolor sit amet consectetur, adipisicing elit. Maxime cupiditate dolores quam officiis similique commodi reprehenderit veritatis ducimus vel in explicabo facilis eveniet fugit quasi quibusdam, repellat magni itaque. Cumque </p> <p class="para2"> This is paragraph two. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quidem. </p> </body> </html> Web Programming (22UIS503C) 6 Department of Information Science and Engineering Output: We b Programming (22UIS503C) 7 Department of Information Science and Engineering Assignment No. - 3 3. Develop JavaScript scripts for the following: i.to model a simple calculator using 'switch' statement <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF - 8"> <meta name="viewport" content="width=device - width, initial - scale=1.0"> <title>Document</title> </head> <body> <script> function calculator() { let num1 = parseInt(prompt("Enter the first number:")); let num2 = parseInt(prompt("Enter the second number:")); let op = prompt("Enter an operator (+, - , *, /, %):"); let result; switch (op) { case '+': result = num1 + num2; break; case ' - ': result = num1 - num2; break; case '*': result = num1 * num2; break; case '%': Web Programming (22UIS503C) 8 Department of Information Science and Engineering result = num1 % num2; break; case '/': if (num2 === 0) { alert("Error: Division by zero is not allowed."); result = null; } else { result = num1 / num2; } break; default: alert("Invalid operator entered."); result = null; } if (result !== null) { alert(num1 + " " + op + " = " + result); } } calculator(); </script> </body> </html> We b Programming (22UIS503C) 9 Department of Information Science and Engineering Output: Web Programming (22UIS503C) 10 Department of Information Science and Engineering We b Programming (22UIS503C) 11 Department of Information Science and Engineering ii.to print the number of prime numbers in a given range L to R using functions <!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Prime Count</title> </head> <body> <script type="text/javascript"> function findPrimesInRange() { let start = parseInt(prompt("Enter the starting number:")); let end = parseInt(prompt("Enter the ending number:")); const primes = []; if (start < 2) { start = 2; } for (let num = start; num <= end; num++) { let isPrime = true; for (let i = 2; i <= Math.sqrt(num); i++) { if (num % i === 0) { isPrime = false; break; } } if (isPrime) { primes.push(num); } } Web Programming (22UIS503C) 12 Department of Information Science and Engineering alert(`Number of prime numbers between ${start} and ${end} are: ${primes.length} \ nThey are: ${primes.join(', ')}`); } findPrimesInRange(); </script> </body> </html> We b Programming (22UIS503C) 13 Department of Information Science and Engineering Output: Web Programming (22UIS503C) 14 Department of Information Science and Engineering We b Programming (22UIS503C) 15 Department of Information Science and Engineering iii.to find whether the given number is an Armstrong number using functions <!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>General Armstrong Number Check</title> <script type="text/javascript"> function armstrong() { const originalNum = parseInt(prompt("Enter a number to check if it's an Armstrong number:")); let num = originalNum; let sum = 0; let numberOfDigits = String(originalNum).length; while (num > 0) { let digit = num % 10; sum += Math.pow(digit, numberOfDigits); num = Math.floor(num / 10); } if (sum === originalNum) { alert(originalNum + " is an Armstrong number."); } else { Web Programming (22UIS503C) 16 Department of Information Science and Engineering alert(originalNum + " is not an Armstrong number."); } } </script> </head> <body> <script> armstrong(); </script> </body> </html> We b Programming (22UIS503C) 17 Department of Information Science and Engineering Output: Web Programming (22UIS503C) 18 Department of Information Science and Engineering iv. to find the number of occurrences of a character in a string using functions. <!DOCTYPE html PUBLIC " - //W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1 - transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Character Occurrence</title> <script type="text/javascript"> function countCharacterOccurrences() { const str = prompt("Enter a string:"); if (str === null || str === "") { alert("No string was entered."); return; } const charToCount = prompt("Enter the character you want to count:"); if (charToCount === null || charToCount.length !== 1) { alert("Please enter a single character."); return; } let count = 0; for (let i = 0; i < str.length; i++) { if (str[i] === charToCount) { count++; } We b Programming (22UIS503C) 19 Department of Information Science and Engineering } alert("The character '" + charToCount + "' appears " + count + " time(s) in the string."); } </script> </head> <body onload="countCharacterOccurrences()"> <h2>Character Occurrence Counter</h2> </body> </html> Web Programming (22UIS503C) 20 Department of Information Science and Engineering Output: